<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
    <title>IT notes</title>
    <subtitle>Personal DBRE, Linux, databases, FreeBSD, and Rust reference notes.</subtitle>
    <link rel="self" type="application/atom+xml" href="https://nbari.com/atom.xml"/>
    <link rel="alternate" type="text/html" href="https://nbari.com"/>
    <generator uri="https://www.getzola.org/">Zola</generator>
    <updated>2026-03-31T11:10:12+00:00</updated>
    <id>https://nbari.com/atom.xml</id>
    <entry xml:lang="en">
        <title>exiftool</title>
        <published>2026-03-31T11:10:12+00:00</published>
        <updated>2026-03-31T11:10:12+00:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/exiftool/"/>
        <id>https://nbari.com/exiftool/</id>
        
        <content type="html" xml:base="https://nbari.com/exiftool/">&lt;p&gt;To clear all metadata from a PDF file, you can use the &lt;code&gt;exiftool&lt;/code&gt; command-line tool. Here&#39;s how you can do it:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;exiftool -all= -overwrite_original yourfile.pdf&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To add metadata to a PDF file, you can use the following command:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;exiftool -Title=&amp;quot;Your Title&amp;quot; -Author=&amp;quot;Your Name&amp;quot; -Subject=&amp;quot;Your Subject&amp;quot; -Keywords=&amp;quot;keyword1, keyword2&amp;quot; yourfile.pdf&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>plex claim</title>
        <published>2025-12-19T18:03:03+00:00</published>
        <updated>2025-12-19T18:03:03+00:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/plex-claim/"/>
        <id>https://nbari.com/plex-claim/</id>
        
        <content type="html" xml:base="https://nbari.com/plex-claim/">&lt;p&gt;To claim your Plex server, (for example in proxmox), modify &lt;code&gt;/var/lib/plexmediaserver/Library/Application\ Support/Plex\ Media\ Server/Preferences.xml&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Add the following line inside the &lt;code&gt;&amp;lt;Preferences&amp;gt;&lt;/code&gt; tag:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;xml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;allowedNetworks=&amp;quot;10.13.0.0/23&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This will allow Plex to be claimed from the specified network range.&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>ansible rekey</title>
        <published>2025-11-01T13:48:48+00:00</published>
        <updated>2025-11-01T13:48:48+00:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/ansible-rekey/"/>
        <id>https://nbari.com/ansible-rekey/</id>
        
        <content type="html" xml:base="https://nbari.com/ansible-rekey/">&lt;p&gt;Create new key:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;openssl&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; ecparam -name prime256v1 -genkey -noout -out private.ec.key&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Save key in 1password:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;op&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; document create private.ec.key --title&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;Ansible Vault EC Key&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; --vault&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;Private&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Test that you can get the key back out:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;op&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; read&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;op://Private/Ansible Vault EC Key/private.ec.key&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Shred old key:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;shred&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -u private.ec.key&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Edit your ansible config file and change the current value of &lt;code&gt;vault_password_file&lt;/code&gt; to point to the old vault password file:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;vault_password_file&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; =&lt;/span&gt;&lt;span&gt; vaultpw-old.sh&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Run the rekey command:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;ansible-vault&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; rekey --new-vault-password-file=vaultpw-new.sh your-vault-file.yml&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The contents of vaultpw-new.sh should be:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;#!/bin/bash&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;op&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; read&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;op://Private/Ansible Vault EC Key/private.ec.key&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To rekey all yoour vault files, you can use find:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;find&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; . -type f&lt;/span&gt;&lt;span&gt; \(&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -name&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;*.yml&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -o -name&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;*.yaml&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt; \)&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; |&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt; while&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt; read&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; file&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt; do&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;    if&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt; head&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -1&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span&gt;$file&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; 2&amp;gt;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;/dev/null&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; |&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt; grep&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -q&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;#39;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;$ANSIBLE_VAULT;&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39;;&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt; then&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;        echo&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;Rekeying: &lt;/span&gt;&lt;span&gt;$file&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;        ansible-vault&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; rekey --new-vault-password-file=vaultpw.sh&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span&gt;$file&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;    fi&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;done&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Finally, update your ansible config file to point to the new vault password file:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;vault_password_file&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; =&lt;/span&gt;&lt;span&gt; vaultpw-new.sh&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>ai-cli</title>
        <published>2025-10-31T09:57:25+00:00</published>
        <updated>2025-10-31T09:57:25+00:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/ai-cli/"/>
        <id>https://nbari.com/ai-cli/</id>
        
        <content type="html" xml:base="https://nbari.com/ai-cli/">&lt;p&gt;To install any of the AI CLI tools, you can use the following command:&lt;/p&gt;
&lt;p&gt;Notice the &lt;code&gt;--prefix ~/.local&lt;/code&gt; flag, which installs the package in your home directory, avoiding the need for sudo permissions.&lt;/p&gt;
&lt;p&gt;For Gemini:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;npm&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; install -g @google/gemini-cli --prefix ~/.local&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;For Claude Code:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;npm&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; install -g @anthropic-ai/claude-code --prefix ~/.local&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;or for GitHub Copilot:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;npm&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; install -g @github/copilot --prefix ~/.local&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>podman macOS</title>
        <published>2025-08-18T12:20:54+00:00</published>
        <updated>2025-08-18T12:20:54+00:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/podman/"/>
        <id>https://nbari.com/podman/</id>
        
        <content type="html" xml:base="https://nbari.com/podman/">&lt;p&gt;Installing &lt;code&gt;podman&lt;/code&gt; on macOS is straightforward using Homebrew. Here are the steps to get it up and running:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;brew&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; install podman&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Create a Podman machine to run containers:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;podman&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; machine init --cpus&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 4&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; --memory&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 8192&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;Disk defaults to 100GB, you can change it with &lt;code&gt;--disk-size&lt;/code&gt; option.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Start the Podman machine:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;podman&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; machine start&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To verify that Podman is running correctly, you can check the status of the machine:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;podman&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; machine info&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To test amd64 architecture compatibility, you can run a simple container:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;podman&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; run --arch amd64 -it rockylinux:9 bash&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>pyenv pipx</title>
        <published>2025-06-27T16:38:29+00:00</published>
        <updated>2025-06-27T16:38:29+00:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/pyenv-tools/"/>
        <id>https://nbari.com/pyenv-tools/</id>
        
        <content type="html" xml:base="https://nbari.com/pyenv-tools/">&lt;p&gt;Create a &lt;code&gt;tools&lt;/code&gt; virtual environment using &lt;code&gt;pyenv&lt;/code&gt;, to install tools like &lt;code&gt;pipx&lt;/code&gt; and other Python utilities.:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;pyenv&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; virtualenv tools&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;if need a special Python version, use:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;pyenv&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; virtualenv&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 3.13.5&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; tools&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Activate the tools virtual environment:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;pyenv&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; activate tools&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Install &lt;code&gt;pipx&lt;/code&gt; in the tools virtual environment:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;pip&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; install pipx&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now run the &lt;code&gt;pipx ensurepath&lt;/code&gt; command to ensure that the &lt;code&gt;pipx&lt;/code&gt; binary is in your PATH:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;pipx&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; ensurepath&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;Normally the path is &lt;code&gt;$HOME/.local/bin&lt;/code&gt;, and the apps will be simlinked there.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Now install ansible using &lt;code&gt;pipx&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;pipx&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; install ansible&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Or a specicfic version of Ansible, like for example to cover this problem: &lt;a rel=&quot;external&quot; href=&quot;https://nbari.com/pipx-ansible/&quot;&gt;SyntaxError: future feature annotations is not defined&lt;/a&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;pipx&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; install ansible-core==&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;2.16.8&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;pipx&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; inject ansible-core passlib&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You can now deactivate the tools virtual environment:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;pyenv&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; deactivate&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then for example to install ansible collections, you can use:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;ansible-galaxy&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; collection install ansible.posix&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;ansible-galaxy&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; collection install ansible.utils&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;ansible-galaxy&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; collection install community.crypto&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;ansible-galaxy&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; collection install community.general&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;ansible-galaxy&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; collection install community.hashi_vault&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;ansible-galaxy&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; collection install community.mysql&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;ansible-galaxy&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; collection install community.postgresql&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To list the installed collections, you can use:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;ansible-galaxy&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; collection list&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>faillock</title>
        <published>2025-05-25T18:17:45+00:00</published>
        <updated>2025-05-25T18:17:45+00:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/faillock/"/>
        <id>https://nbari.com/faillock/</id>
        
        <content type="html" xml:base="https://nbari.com/faillock/">&lt;p&gt;If you enter the wrong password too many times, your account may be locked out.
The &lt;code&gt;faillock&lt;/code&gt; command is used to manage this lockout mechanism.&lt;/p&gt;
&lt;p&gt;Check the current lockout status with:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;faillock&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; --user&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;lt;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;usernam&lt;/span&gt;&lt;span&gt;e&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If you still have access to the system, you can unlock your account by using
the &lt;code&gt;faillock&lt;/code&gt; command.&lt;/p&gt;
&lt;p&gt;If you want to reset the lockout for a specific user, you can use:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;faillock&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; --user&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;lt;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;usernam&lt;/span&gt;&lt;span&gt;e&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; --reset&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;or:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;rm&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; /var/run/faillock/myUsername&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The directory where the faillock records are stored is typically
&lt;code&gt;/var/run/faillock/&lt;/code&gt;. You can view the contents of this directory to see the
lockout records.&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;ls&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -l /var/run/faillock/&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>URL encode using jq</title>
        <published>2025-05-22T16:29:32+00:00</published>
        <updated>2025-05-22T16:29:32+00:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/url-encode-jq/"/>
        <id>https://nbari.com/url-encode-jq/</id>
        
        <content type="html" xml:base="https://nbari.com/url-encode-jq/">&lt;p&gt;When using pgcli and if want to use -D &amp;lt;alias_dsn&amp;gt; if your password is using special characters, you can use jq to URL encode the password.&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;echo&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -n&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;#39;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;My@Secure:Pa$$word&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39; |&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt; jq&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -Rr @uri&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>dropbox-cli No module named &#39;gi&#39;</title>
        <published>2025-03-15T12:58:37+00:00</published>
        <updated>2025-03-15T12:58:37+00:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/dropbox/"/>
        <id>https://nbari.com/dropbox/</id>
        
        <content type="html" xml:base="https://nbari.com/dropbox/">&lt;p&gt;When trying to install &lt;code&gt;dropbox-cli&lt;/code&gt; on a Linux system, you may encounter the following error:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;../dropbox-cli/src/nautilus-dropbox-2024.04.17/build_dropbox.py&amp;quot;, line 2, in &amp;lt;module&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    import gi&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ModuleNotFoundError: No module named &amp;#39;gi&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;==&amp;gt; ERROR: A failure occurred in build().&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Try to install &lt;code&gt;pygobject&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;pip&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; install pygobject&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then try to install &lt;code&gt;dropbox-cli&lt;/code&gt; again:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;paru&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -Syu dropbox-cli&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>ethtool tso offloading</title>
        <published>2025-03-07T13:03:06+00:00</published>
        <updated>2025-03-07T13:03:06+00:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/ethtool-tso/"/>
        <id>https://nbari.com/ethtool-tso/</id>
        
        <content type="html" xml:base="https://nbari.com/ethtool-tso/">&lt;p&gt;If you are experiencing slow network performance on a Linux server, it might be
due to offloading features of the network card. Offloading is a technique used
by network cards to offload the processing of network traffic from the CPU to
the network card. This can improve performance by reducing the load on the CPU,
but it can also cause problems if the network card is not properly configured.&lt;/p&gt;
&lt;p&gt;To check the current offloading settings of a network card, you can use:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;ethool&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -k eth0&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To disable offloading features, you can use:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;ethtool&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -K eth1 tso off gso off gro off&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To enable them again, you can use:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;ethtool&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -K eth1 tso on gso on gro on&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;For example, this is the output of &lt;code&gt;iperf3&lt;/code&gt; with offloading enabled:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-----------------------------------------------------------&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[ ID] Interval           Transfer     Bitrate&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[  5]   0.00-1.00   sec  83.4 MBytes   700 Mbits/sec&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[  5]   1.00-2.00   sec  82.5 MBytes   692 Mbits/sec&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[  5]   2.00-3.00   sec  82.5 MBytes   692 Mbits/sec&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[  5]   3.00-4.00   sec  82.5 MBytes   692 Mbits/sec&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[  5]   4.00-5.00   sec  82.5 MBytes   692 Mbits/sec&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[  5]   5.00-6.00   sec  82.6 MBytes   693 Mbits/sec&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[  5]   6.00-7.00   sec  82.5 MBytes   692 Mbits/sec&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[  5]   7.00-8.00   sec  82.5 MBytes   692 Mbits/sec&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[  5]   8.00-9.00   sec  82.5 MBytes   692 Mbits/sec&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[  5]   9.00-10.00  sec  82.4 MBytes   691 Mbits/sec&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[  5]  10.00-10.00  sec   191 KBytes   691 Mbits/sec&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;- - - - - - - - - - - - - - - - - - - - - - - - -&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[ ID] Interval           Transfer     Bitrate&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[  5]   0.00-10.00  sec   826 MBytes   693 Mbits/sec                  receiver&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-----------------------------------------------------------&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Server listening on 5201 (test #3)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And after disabling offloading:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[ ID] Interval           Transfer     Bitrate         Retr  Cwnd&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[  5]   0.00-1.00   sec   113 MBytes   948 Mbits/sec    0    379 KBytes&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[  5]   1.00-2.00   sec   113 MBytes   945 Mbits/sec    0    379 KBytes&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[  5]   2.00-3.00   sec   112 MBytes   942 Mbits/sec    0    397 KBytes&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[  5]   3.00-4.00   sec   112 MBytes   942 Mbits/sec    0    414 KBytes&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[  5]   4.00-5.00   sec   112 MBytes   939 Mbits/sec    0    414 KBytes&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[  5]   5.00-6.00   sec   112 MBytes   941 Mbits/sec    0    414 KBytes&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[  5]   6.00-7.00   sec   112 MBytes   943 Mbits/sec    0    414 KBytes&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[  5]   7.00-8.00   sec   112 MBytes   941 Mbits/sec    0    414 KBytes&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[  5]   8.00-9.00   sec   112 MBytes   942 Mbits/sec    0    414 KBytes&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[  5]   9.00-10.00  sec   112 MBytes   939 Mbits/sec    0    414 KBytes&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;- - - - - - - - - - - - - - - - - - - - - - - - -&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[ ID] Interval           Transfer     Bitrate         Retr&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[  5]   0.00-10.00  sec  1.10 GBytes   942 Mbits/sec    0             sender&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[  5]   0.00-10.00  sec  1.10 GBytes   941 Mbits/sec                  receiver&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;if you disable offloading you may notice more CPU usage, but the network performance should be better.&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>pdf merge</title>
        <published>2025-01-15T10:08:26+00:00</published>
        <updated>2025-01-15T10:08:26+00:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/pdf-merge/"/>
        <id>https://nbari.com/pdf-merge/</id>
        
        <content type="html" xml:base="https://nbari.com/pdf-merge/">&lt;p&gt;To merge only the first page of two PDF files, you can use the following command:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;qpdf&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; --empty --pages pdf1.pdf&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 1&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; pdf2.pdf&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 1&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -- output.pdf&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>versionlock</title>
        <published>2025-01-09T18:00:24+00:00</published>
        <updated>2025-01-09T18:00:24+00:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/versionlock/"/>
        <id>https://nbari.com/versionlock/</id>
        
        <content type="html" xml:base="https://nbari.com/versionlock/">&lt;p&gt;To lock the version of a package, you can use &lt;code&gt;versionlock&lt;/code&gt;.&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;yum&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; versionlock add openssl&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Or with dnf:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;dnf&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; versionlock add openssl&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To see the list of locked packages:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;yum&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; versionlock list&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;or with dnf:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;dnf&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; versionlock list&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To remove a package from the list:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;yum&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; versionlock delete openssl&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;or with dnf:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;dnf&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; versionlock delete openssl&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>pip-review</title>
        <published>2024-11-16T18:26:44+00:00</published>
        <updated>2024-11-16T18:26:44+00:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/pip-review/"/>
        <id>https://nbari.com/pip-review/</id>
        
        <content type="html" xml:base="https://nbari.com/pip-review/">&lt;p&gt;To upgrade all packages installed with pip:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;pip&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; install pip-review&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then run:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;pip-review&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; --auto&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;As an alternative, you can use:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;pip&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; list --outdated&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; |&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt; awk&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;#39;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;NR &amp;gt; 2 {print $1}&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39; |&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt; xargs&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -n1 pip install --upgrade&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>proxmox ssh port</title>
        <published>2024-10-30T09:02:57+00:00</published>
        <updated>2024-10-30T09:02:57+00:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/proxmox-ssh-port/"/>
        <id>https://nbari.com/proxmox-ssh-port/</id>
        
        <content type="html" xml:base="https://nbari.com/proxmox-ssh-port/">&lt;p&gt;If you change the proxmox ssh port modify the &lt;code&gt;/root/.ssh/config&lt;/code&gt; file to include the new port:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Host 10.0.1.2 10.0.1.3 10.0.1.4&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   Port 2222&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>pipx ansible</title>
        <published>2024-10-25T19:46:32+00:00</published>
        <updated>2024-10-25T19:46:32+00:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/pipx-ansible/"/>
        <id>https://nbari.com/pipx-ansible/</id>
        
        <content type="html" xml:base="https://nbari.com/pipx-ansible/">&lt;p&gt;Install &lt;code&gt;pipx&lt;/code&gt; with &lt;code&gt;ansible&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;brew&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; install pipx&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To prevent the following error: (mainly in redhat 8)&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SyntaxError: future feature annotations is not defined&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Install ansible &amp;lt; 2.17:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;pipx&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; install ansible-core==&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;2.16.8&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Add passlib:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;pipx&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; inject ansible-core passlib&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>pip offline</title>
        <published>2024-08-12T16:06:55+00:00</published>
        <updated>2024-08-12T16:06:55+00:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/pip-offline/"/>
        <id>https://nbari.com/pip-offline/</id>
        
        <content type="html" xml:base="https://nbari.com/pip-offline/">&lt;p&gt;To install pip packages offline first download all the packages, for example to
install &lt;code&gt;pgcli&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;pip&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; download pgcli -d packages_downloads&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then you can &lt;code&gt;tar&lt;/code&gt; and share the file to your offline server:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;tar -cf pgcli.tar.gz package_downloads/&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In the server without internet you can unarchive to dir named &lt;code&gt;wrk&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;tar&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -xvf pgcli.tar.gz wrk&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then to install do:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;pip&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; install --no-index --find-links&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;./wrk/&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; ./wrk/pgcli-4.1.0-py3-none-any.whl&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Swap usage</title>
        <published>2024-08-07T06:43:48+00:00</published>
        <updated>2024-08-07T06:43:48+00:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/swap-usage/"/>
        <id>https://nbari.com/swap-usage/</id>
        
        <content type="html" xml:base="https://nbari.com/swap-usage/">&lt;p&gt;Get a swap usage by pid/command:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;ps&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -e -o pid,comm --no-headers&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; |&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt; while&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt; read&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -r pid comm&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt; do&lt;/span&gt;&lt;span&gt; swap&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=$(&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;grep&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; Swap /proc/&lt;/span&gt;&lt;span&gt;$pid&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;/smaps&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; 2&amp;gt;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;/dev/null&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; |&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt; awk&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;#39;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;{ sum += $2 } END { print sum }&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39;); [ -n &amp;quot;&lt;/span&gt;&lt;span&gt;$swap&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; ] &amp;amp;&amp;amp;&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt; echo&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;PID: &lt;/span&gt;&lt;span&gt;$pid&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; - Swap used: &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;${&lt;/span&gt;&lt;span&gt;swap&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;:-&lt;/span&gt;&lt;span&gt;0&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; kB - Command: &lt;/span&gt;&lt;span&gt;$comm&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;;&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt; done&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; |&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt; sort&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -k6 -nr&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Using Top:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;top&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -o SWAP -bn1&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; |&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt; head&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -n20&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Get vault token</title>
        <published>2024-08-06T16:17:25+00:00</published>
        <updated>2024-08-06T16:17:25+00:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/get-vault-token/"/>
        <id>https://nbari.com/get-vault-token/</id>
        
        <content type="html" xml:base="https://nbari.com/get-vault-token/">&lt;p&gt;Get a &lt;code&gt;vault&lt;/code&gt; token and request a new one only if expired using direnv and 1password cli:&lt;/p&gt;
&lt;p&gt;The script:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;#!/bin/bash&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;# Determine the full path of the current script&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SCRIPT_PATH&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=$(&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;realpath&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot; z-i&quot;&gt;$0&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;# Extract directory names for the suffix&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SCRIPT_DIR&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=$(&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;dirname&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span&gt;$SCRIPT_PATH&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;CURRENT_DIR&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=$(&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;basename&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span&gt;$SCRIPT_DIR&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PARENT_DIR&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=$(&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;basename&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;$(&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;dirname&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span&gt;$SCRIPT_DIR&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;)&amp;quot;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;GRANDPARENT_DIR&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=$(&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;basename&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;$(&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;dirname&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;$(&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;dirname&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span&gt;$SCRIPT_DIR&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;)&amp;quot;)&amp;quot;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;# Construct the suffix and token file path&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SUFFIX&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&amp;quot;${&lt;/span&gt;&lt;span&gt;GRANDPARENT_DIR&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;${&lt;/span&gt;&lt;span&gt;PARENT_DIR&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;${&lt;/span&gt;&lt;span&gt;CURRENT_DIR&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;TOKEN_FILE&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&amp;quot;&lt;/span&gt;&lt;span&gt;$HOME&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;/.vault_token-&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;${&lt;/span&gt;&lt;span&gt;SUFFIX&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;.json&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;# Function to fetch a new token from Vault&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;fetch_new_token&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;() {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-8&quot;&gt;    local&lt;/span&gt;&lt;span&gt; retries&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;3&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-8&quot;&gt;    local&lt;/span&gt;&lt;span&gt; attempt&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;    while&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; ((&lt;/span&gt;&lt;span&gt;attempt&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;lt;=&lt;/span&gt;&lt;span&gt; retries&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;));&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt; do&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        GITHUB_TOKEN&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=$(&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;op&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; read&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;op://Private/Github/token&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;        if&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt; vault&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; login -method=github token=&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;$GITHUB_TOKEN&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -format=json&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; |&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt; tee&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span&gt;$TOKEN_FILE&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; &amp;gt;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;/dev/null&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt; then&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;            return&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;        fi&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;        sleep&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 2&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        ((&lt;/span&gt;&lt;span&gt;attempt&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;++))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;    done&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;    echo&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;Failed to fetch token after &lt;/span&gt;&lt;span&gt;$retries&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; attempts. Exiting.&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;    exit&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;# Check if the token file exists and is valid&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; [ -f &amp;quot;&lt;/span&gt;&lt;span&gt;$TOKEN_FILE&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; ];&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt; then&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    LEASE_DURATION&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=$(&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;jq&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -r&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;#39;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;.auth.lease_duration&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39; &amp;quot;&lt;/span&gt;&lt;span&gt;$TOKEN_FILE&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    FILE_CREATION_TIME&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=$(&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt;stat&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -c %Z&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span&gt;$TOKEN_FILE&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    CURRENT_TIME&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=$(&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;date&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; +%s&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    EXPIRATION_TIME&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=$((&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;FILE_CREATION_TIME&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; + LEASE_DURATION&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;    if&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; [ &amp;quot;&lt;/span&gt;&lt;span&gt;$CURRENT_TIME&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; -ge &amp;quot;&lt;/span&gt;&lt;span&gt;$EXPIRATION_TIME&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; ];&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt; then&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;        fetch_new_token&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;    fi&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;else&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;    fetch_new_token&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;fi&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;# Export the token&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;VAULT_TOKEN&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=$(&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;jq&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -r&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;#39;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;.auth.client_token&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39; &amp;quot;&lt;/span&gt;&lt;span&gt;$TOKEN_FILE&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; [ &amp;quot;&lt;/span&gt;&lt;span&gt;$VAULT_TOKEN&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; = &amp;quot;&amp;quot; ];&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt; then&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;    echo&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;Error: Failed to read VAULT_TOKEN from &lt;/span&gt;&lt;span&gt;$TOKEN_FILE&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;    exit&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;fi&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;echo&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;export VAULT_TOKEN=&lt;/span&gt;&lt;span&gt;\&amp;quot;$VAULT_TOKEN\&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In &lt;code&gt;.envrc&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-8&quot;&gt;export&lt;/span&gt;&lt;span&gt; VAULT_ADDR&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&lt;/span&gt;&lt;span&gt;https://vault.your.host&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;eval&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;$(&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;./get_token.sh&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;)&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This will create and store the token in &lt;code&gt;$HOME/.vault_token-&amp;lt;path&amp;gt;.json&lt;/code&gt;, for
example, if your project is in &lt;code&gt;/home/projects/company/vault/test&lt;/code&gt;, file will be stored in:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;~/.vault_token-company-vault-test.json&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;That will cover your &lt;code&gt;TEST&lt;/code&gt; env, for &lt;code&gt;PROD&lt;/code&gt; maybe you have something like:
&lt;code&gt;/home/projects/company/vault/prod&lt;/code&gt;, file will be stored in:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;~/.vault_token-company-vault-prod.json&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>proxmox cpu</title>
        <published>2024-07-30T06:47:34+00:00</published>
        <updated>2024-07-30T06:47:34+00:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/proxmox-cpu/"/>
        <id>https://nbari.com/proxmox-cpu/</id>
        
        <content type="html" xml:base="https://nbari.com/proxmox-cpu/">&lt;p&gt;To change CPU type to &lt;code&gt;host&lt;/code&gt;, unmount CD ISO and enable start on boot:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;mapfile&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -t vm_ids&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;lt; &amp;lt;(&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;qm&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; list&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; |&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt; awk&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;#39;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;NR&amp;gt;1 {print $1}&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;# Changing CPU type to host and enabling start on boot for each VM&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;for&lt;/span&gt;&lt;span&gt; vm&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt; in&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;${&lt;/span&gt;&lt;span&gt;vm_ids&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;[@]}&amp;quot;;&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt; do&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;    # Change CPU type to host&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;    if&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt; qm&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; set&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span&gt;$vm&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; --cpu host&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt; then&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;        echo&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;Successfully changed CPU type to host for VM ID: &lt;/span&gt;&lt;span&gt;$vm&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;    else&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;        echo&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;Failed to change CPU type to host for VM ID: &lt;/span&gt;&lt;span&gt;$vm&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; &amp;gt;&amp;amp;2&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;    fi&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;    # Unmount CD ISO&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;    if&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt; qm&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; set&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span&gt;$vm&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -ide2 none&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt; then&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;        echo&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;Successfully unmounted CD ISO for VM ID: &lt;/span&gt;&lt;span&gt;$vm&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;    else&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;        echo&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;Failed to unmount CD ISO for VM ID: &lt;/span&gt;&lt;span&gt;$vm&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; &amp;gt;&amp;amp;2&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;    fi&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;    # Enable start on boot&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;    if&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt; qm&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; set&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span&gt;$vm&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; --onboot&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 1&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt; then&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;        echo&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;Successfully enabled start on boot for VM ID: &lt;/span&gt;&lt;span&gt;$vm&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;    else&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;        echo&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;Failed to enable start on boot for VM ID: &lt;/span&gt;&lt;span&gt;$vm&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; &amp;gt;&amp;amp;2&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;    fi&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;done&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>proxmox tablet</title>
        <published>2024-07-30T06:12:59+00:00</published>
        <updated>2024-07-30T06:12:59+00:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/proxmox-tablet/"/>
        <id>https://nbari.com/proxmox-tablet/</id>
        
        <content type="html" xml:base="https://nbari.com/proxmox-tablet/">&lt;p&gt;If you are not using GUI remove &quot;use pointe for tablet&quot; to save some CPU:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;mapfile&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -t vm_ids&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;lt; &amp;lt;(&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;qm&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; list&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; |&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt; awk&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;#39;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;NR&amp;gt;1 {print $1}&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;for&lt;/span&gt;&lt;span&gt; vm&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt; in&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;${&lt;/span&gt;&lt;span&gt;vm_ids&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;[@]}&amp;quot;;&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt; do&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;    if&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt; qm&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; set&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span&gt;$vm&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; --tablet&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 0&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt; then&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;        echo&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;Successfully disabled tablet for VM ID: &lt;/span&gt;&lt;span&gt;$vm&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;    else&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;        echo&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;Failed to disable tablet for VM ID: &lt;/span&gt;&lt;span&gt;$vm&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; &amp;gt;&amp;amp;2&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;    fi&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;done&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>proxmox vlan</title>
        <published>2024-06-26T14:42:50+00:00</published>
        <updated>2024-06-26T14:42:50+00:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/proxmox-vlan/"/>
        <id>https://nbari.com/proxmox-vlan/</id>
        
        <content type="html" xml:base="https://nbari.com/proxmox-vlan/">&lt;p&gt;If you have a single network interface and want to have your VM&#39;s in a VLAN,
modify the &lt;code&gt;/etc/network/interfaces&lt;/code&gt; to look something like:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;auto lo&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;iface lo inet loopback&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;iface eno1 inet manual&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;auto vmbr0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;iface vmbr0 inet static&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	address 192.168.0.2/24&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	gateway 192.168.0.1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	bridge-ports eno1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	bridge-stp off&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	bridge-fd 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;auto vmbr1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;iface vmbr1 inet manual&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	bridge-ports eno1.20&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	bridge-stp off&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	bridge-fd 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;iface eno1.20 inet manual&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	vlan-raw-device eno1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;source /etc/network/interfaces.d/*&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;After modifying apply the changes:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;systemctl&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; restart networking&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In this case, thee is only one interface &lt;code&gt;eno1&lt;/code&gt; and the VLAN-ID is &lt;code&gt;20&lt;/code&gt;&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>gnome-libsecret</title>
        <published>2024-06-16T12:37:42+00:00</published>
        <updated>2024-06-16T12:37:42+00:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/gnome-libsecret/"/>
        <id>https://nbari.com/gnome-libsecret/</id>
        
        <content type="html" xml:base="https://nbari.com/gnome-libsecret/">&lt;p&gt;If running Gnome, Hyperland and want to use
&lt;a rel=&quot;external&quot; href=&quot;https://www.getmailspring.com/&quot;&gt;Mailspring&lt;/a&gt;, modify:
&lt;code&gt;/usr/share/applications/Mailspring.desktop&lt;/code&gt; to use &lt;code&gt;gnome-libsecret&lt;/code&gt; change line:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Exec=mailspring %U&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;to:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Exec=mailspring --password-store=&amp;quot;gnome-libsecret&amp;quot; %U&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;File may looks something like:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[Desktop Entry]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Name=Mailspring&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Comment=The best email app for people and teams at work&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;GenericName=Mail Client&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Exec=mailspring --password-store=&amp;quot;gnome-libsecret&amp;quot; %U&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Icon=mailspring&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Type=Application&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;...&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>SysRq</title>
        <published>2024-04-29T18:41:13+00:00</published>
        <updated>2024-04-29T18:41:13+00:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/sysrq/"/>
        <id>https://nbari.com/sysrq/</id>
        
        <content type="html" xml:base="https://nbari.com/sysrq/">&lt;p&gt;To find the &lt;code&gt;SysRq&lt;/code&gt; in your system, normally &lt;code&gt;PrtSc&lt;/code&gt;, run:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;journalctl&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -f&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And then press keys &lt;code&gt;Alt Gr&lt;/code&gt; + &lt;code&gt;PrtSc&lt;/code&gt; + &lt;code&gt;h&lt;/code&gt; that will print in the logs something like:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;the Right &lt;code&gt;Alt GR&lt;/code&gt; only works printing the help&lt;/p&gt;
&lt;/blockquote&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;kernel: sysrq: HELP: loglevel(0-9) reboot(b) crash(c) terminate-all-tasks(e) memory-full-oom-kill(f)...&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;enabling&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#enabling&quot; aria-label=&quot;Anchor link for: enabling&quot;&gt;🔗&lt;/a&gt;Enabling&lt;/h2&gt;
&lt;p&gt;create &lt;code&gt;/etc/sysctl.d/99-sysctl.conf&lt;/code&gt; with:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;kernel.sysrq = 1&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;then:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;sysctl&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; --system&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;using-reisub&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#using-reisub&quot; aria-label=&quot;Anchor link for: using-reisub&quot;&gt;🔗&lt;/a&gt;Using  REISUB&lt;/h2&gt;
&lt;p&gt;To reboot system in a crash run:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Alt + SysRq (Hold down) + R, E, I, S, U, B&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;R: Switch the keyboard mode&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;E: Send the SIGTERM signal to all processes except init&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;I: Send the SIGKILL signal to all processes except init&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;S: Sync all mounted filesystems&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;U: Remount all mounted filesystems in read-only mode&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;B: Reboot the system&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To only reboot:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ALT + SysRq + b&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;https://wiki.archlinux.org/title/Keyboard_shortcuts#Rebooting&lt;/li&gt;
&lt;li&gt;https://en.wikipedia.org/wiki/Magic_SysRq_key&lt;/li&gt;
&lt;/ul&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>debug Github secrets</title>
        <published>2024-04-25T06:06:27+00:00</published>
        <updated>2024-04-25T06:06:27+00:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/debug-github-secrets/"/>
        <id>https://nbari.com/debug-github-secrets/</id>
        
        <content type="html" xml:base="https://nbari.com/debug-github-secrets/">&lt;p&gt;To print your secrets and prevent the &lt;code&gt;***&lt;/code&gt; use:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;run&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; echo ${{secrets.YOUR_SECRET }} | sed &amp;#39;s/./&amp;amp; /g&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;or if you have them already in a file:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; name&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; Get head (debug)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;  run&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt; |&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;    echo $(head /file/with/secrets) | sed &amp;#39;s/./&amp;amp; /g&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This will separate each character by an space and print it and allow you to debug your secrets.:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;.&lt;/code&gt; The dot (.) represents any single character in regular expressions.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&amp;amp;&lt;/code&gt; In the replacement part of the expression, &amp;amp; represents the matched pattern. So, in this case, it represents each character matched by &lt;code&gt;.&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>headless mac gh-runner</title>
        <published>2024-04-17T07:40:17+00:00</published>
        <updated>2024-04-17T07:40:17+00:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/headless-mac/"/>
        <id>https://nbari.com/headless-mac/</id>
        
        <content type="html" xml:base="https://nbari.com/headless-mac/">&lt;p&gt;To install an apple via headless, first update:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; softwareupdate -iaR&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then configure ssh to only accept public-keys:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sudo vim /etc/ssh/sshd_config&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Ensure you have this:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PasswordAuthentication no&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ChallengeResponseAuthentication no&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Reboot, test and then install homebrew:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;/bin/bash&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -c&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;$(&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;curl&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;)&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Create a &lt;code&gt;Brewfile&lt;/code&gt;&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; cat&lt;/span&gt;&lt;span&gt; $HOME&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;/Brewfile&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;brew&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;gmp&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;brew&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;libyaml&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;brew&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;tmux&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;brew&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;ssh-vault&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Install with &lt;code&gt;brew bundle&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Create a user for Github Actions (runner)&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; dscl . -create /Users/gh-runner&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; dscl . -create /Users/gh-runner UserShell /bin/zsh&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; dscl . -create /Users/gh-runner RealName&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;GitHub runner&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; dscl . -create /Users/gh-runner UniqueID&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;1001&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; dscl . -create /Users/gh-runner PrimaryGroupID&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 20&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; dscl . -create /Users/gh-runner NFSHomeDirectory /Users/gh-runner&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;# change password&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; dscl . -passwd /Users/gh-runner secret&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; dscl . -append /Groups/admin GroupMembership gh-runner&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; createhomedir -c&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Test:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;su - gh-runner&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>active</title>
        <published>2024-04-10T06:36:42+00:00</published>
        <updated>2024-04-10T06:36:42+00:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/active/"/>
        <id>https://nbari.com/active/</id>
        
        <content type="html" xml:base="https://nbari.com/active/">&lt;p&gt;To remove all comments and empty lines from the file, you can use the following
command:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;grep&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -Ev&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;#39;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;^\s*($|#)&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; file.md&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If you want to diff the file with the same file without comments and empty:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;diff&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; --color -y&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;lt;(&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;grep&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -Ev&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;#39;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;^\s*($|#)&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; file1.md&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;) &amp;lt;(&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;grep&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -Ev&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;#39;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;^\s*($|#)&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; file2.md&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>protonvpn ipv6leakintrf0</title>
        <published>2024-03-13T16:10:41+00:00</published>
        <updated>2024-03-13T16:10:41+00:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/fix-protonvpn/"/>
        <id>https://nbari.com/fix-protonvpn/</id>
        
        <content type="html" xml:base="https://nbari.com/fix-protonvpn/">&lt;p&gt;When using protonvpn you may need to clean up/remove the &lt;code&gt;ipv6leakintrf0&lt;/code&gt; interface if you outbound traffic is not working.&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;nmcli&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; connection delete pvpn-ipv6leak-protection&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;https://github.com/ProtonVPN/linux-cli/issues/43&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>elastic enrollment token</title>
        <published>2024-01-07T14:25:36+00:00</published>
        <updated>2024-01-07T14:25:36+00:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/elastic-import-ca/"/>
        <id>https://nbari.com/elastic-import-ca/</id>
        
        <content type="html" xml:base="https://nbari.com/elastic-import-ca/">&lt;p&gt;When trying to create a node token with:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;./bin/elasticsearch-create-enrollment-token&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -s node&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If get the error:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ERROR: Unable to create an enrollment token. Elasticsearch node HTTP layer SSL configuration is not configured with a keystore, with exit code 73&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;After creating the ca and http:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;./bin/elasticsearch-certutil ca&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; &amp;amp;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;./bin/elasticsearch-certutil http&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Do this:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;cd&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; /usr/share/elasticsearch/jdk/bin&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;./keytool&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -importkeystore -destkeystore /etc/elasticsearch/certs/http.p12 -srckeystore /usr/share/elasticsearch/elastic-stack-ca.p12 -srcstoretype PKCS12&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;keytool&lt;/code&gt;  overwrite and try again, should fix the problem&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Then try adding nodes with:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;./elasticsearch-reconfigure-node&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; --enrollment-token&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;lt;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;toke&lt;/span&gt;&lt;span&gt;n&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If you already installed &lt;code&gt;elastic&lt;/code&gt;, you need to &lt;code&gt;apt --purge remove elasticsearch&lt;/code&gt; then
install again &lt;code&gt;apt install elasticsearch&lt;/code&gt; (remove /var/lib/elasticsearch) and
before starting enroll the new n&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>vim-python</title>
        <published>2023-05-21T20:10:44+00:00</published>
        <updated>2023-05-21T20:10:44+00:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/vim-python/"/>
        <id>https://nbari.com/vim-python/</id>
        
        <content type="html" xml:base="https://nbari.com/vim-python/">&lt;p&gt;If you get:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Warning: vim has no support for python, but it is required to run the formateter !&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Update/Install python with &lt;code&gt;pyenv&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pyenv install 3.11.3&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Clone the Vim repository:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; clone https://github.com/vim/vim.git&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Configure with python support:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;./configure --with-features=huge --enable-multibyte --enable-python3interp&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Build and install:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;make &amp;amp;&amp;amp; sudo make install&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Test running from vim:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;:echo has(&amp;#39;python3&amp;#39;)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;pytuple-type&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#pytuple-type&quot; aria-label=&quot;Anchor link for: pytuple-type&quot;&gt;🔗&lt;/a&gt;PyTuple_Type&lt;/h2&gt;
&lt;p&gt;If get an error about &lt;code&gt;PyTuple_Type&lt;/code&gt;,  use the system python (not &lt;code&gt;pyenv&lt;/code&gt;)&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>readonly=off</title>
        <published>2023-05-04T20:52:48+00:00</published>
        <updated>2023-05-04T20:52:48+00:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/readonly-off/"/>
        <id>https://nbari.com/readonly-off/</id>
        
        <content type="html" xml:base="https://nbari.com/readonly-off/">&lt;p&gt;When booting FreeBSD in single-user mode and the root fs is using zfs, to make it read/write:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;zfs&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; set readonly=off zroot&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;zfs&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; mount -a&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>GIT_SSH_COMMAND</title>
        <published>2023-04-21T12:44:28+00:00</published>
        <updated>2023-04-21T12:44:28+00:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/git-ssh-command/"/>
        <id>https://nbari.com/git-ssh-command/</id>
        
        <content type="html" xml:base="https://nbari.com/git-ssh-command/">&lt;p&gt;If you want to use multiple GitHub accounts, and have your ssh keys stored
in &lt;a rel=&quot;external&quot; href=&quot;https://developer.1password.com/docs/ssh/agent/advanced/#match-key-with-host&quot;&gt;1Password&lt;/a&gt;, the environment variable &lt;code&gt;GIT_SSH_COMMAND&lt;/code&gt; can be used as an alternative to modify your
&lt;code&gt;~/.ssh/config&lt;/code&gt; file&lt;/p&gt;
&lt;p&gt;For example if you need to use &lt;code&gt;key1&lt;/code&gt; for &lt;code&gt;project1&lt;/code&gt; define it like this:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-8&quot;&gt;export&lt;/span&gt;&lt;span&gt; GIT_SSH_COMMAND&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;ssh -i ~/.ssh/key1.pub -F none&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;you can add it to your &lt;code&gt;.envrc&lt;/code&gt; and make it global for all projects within a directory.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The option &lt;code&gt;-F none&lt;/code&gt; or &lt;code&gt;-F /dev/null&lt;/code&gt; makes that no configuration file will be read.&lt;/p&gt;
&lt;p&gt;If you then do:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;ssh&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -T git@github.com&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It will use the key from user &lt;code&gt;key1&lt;/code&gt; without the need to modify to changte the git URL.&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>MYSQLD_OPTS</title>
        <published>2023-04-20T06:30:06+00:00</published>
        <updated>2023-04-20T06:30:06+00:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/mysqld-opts/"/>
        <id>https://nbari.com/mysqld-opts/</id>
        
        <content type="html" xml:base="https://nbari.com/mysqld-opts/">&lt;p&gt;If need to temporarily disable binary logs or set innodb_force_recovery you
can set this in an environment variable instead of modifying the &lt;code&gt;my.cnf&lt;/code&gt; directly, for example:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;systemctl&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; set-environment MYSQLD_OPTS=&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;--innodb_force_recovery=1&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;or&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;systemctl&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; set-environment MYSQLD_OPTS=&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;--skip-log-bin=1&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then restart;&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;systemctl&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; restart mariadb&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To remove the environment var:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;systemctl&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; unset-environment MYSQLD_OPTS&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To check the contents of the environment vars:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;systemctl&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; show-environment&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Mellanox Opnsense R86S</title>
        <published>2023-03-21T13:37:07+00:00</published>
        <updated>2023-03-21T13:37:07+00:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/mellanox/"/>
        <id>https://nbari.com/mellanox/</id>
        
        <content type="html" xml:base="https://nbari.com/mellanox/">&lt;p&gt;If you want to use the SFP+ modules in the R86S, add to the &lt;code&gt;/boot/loader.conf.local&lt;/code&gt;&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mlx4en_load=&amp;quot;YES&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>unknown SSH host key for github.com</title>
        <published>2023-03-10T10:59:57+00:00</published>
        <updated>2023-03-10T10:59:57+00:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/ssh-key-github/"/>
        <id>https://nbari.com/ssh-key-github/</id>
        
        <content type="html" xml:base="https://nbari.com/ssh-key-github/">&lt;p&gt;Caused by:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;error: unknown SSH host key&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;The SSH host key for `github.com` is not known and cannot be validated.&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Fix this by adding Github key to your &lt;code&gt; ~/.ssh/known_hosts&lt;/code&gt;&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;ssh-keyscan&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -t rsa,ecdsa,ed25519 github.com&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;  &amp;gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; ~/.ssh/known_hosts&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>ip flush</title>
        <published>2023-02-02T16:22:54+00:00</published>
        <updated>2023-02-02T16:22:54+00:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/flush/"/>
        <id>https://nbari.com/flush/</id>
        
        <content type="html" xml:base="https://nbari.com/flush/">&lt;p&gt;To remove all ipv6 addresses from and interface:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; ip -6 addr flush dummy0&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;For ipv4:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; ip -4 addr flush dummy0&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>rc.local</title>
        <published>2023-01-26T14:38:36+00:00</published>
        <updated>2023-01-26T14:38:36+00:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/rc-local/"/>
        <id>https://nbari.com/rc-local/</id>
        
        <content type="html" xml:base="https://nbari.com/rc-local/">&lt;p&gt;To enable &lt;code&gt;rc.local&lt;/code&gt; in debian, create the file with contents:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;#!/bin/sh -e&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;# Make sure that the script will &amp;quot;exit 0&amp;quot; on success or any other value on error.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;exit&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Give exec perms:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;chmod +x /etc/rc.local&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;systemctl daemon-reload&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And start with:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;systemctl start rc-local&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>terraform-debug</title>
        <published>2022-11-29T10:25:08+00:00</published>
        <updated>2022-11-29T10:25:08+00:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/terraform-debug/"/>
        <id>https://nbari.com/terraform-debug/</id>
        
        <content type="html" xml:base="https://nbari.com/terraform-debug/">&lt;p&gt;Debug terraform settings this variables:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-8&quot;&gt;export&lt;/span&gt;&lt;span&gt; TF_LOG_PATH&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;/tmp/terraform.log&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-8&quot;&gt;export&lt;/span&gt;&lt;span&gt; TF_LOG&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;DEBUG&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then run terraform as always:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ terraform plan ...&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>vm-bhyve inuc</title>
        <published>2022-09-30T07:49:15+00:00</published>
        <updated>2022-09-30T07:49:15+00:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/vm-bhyve-inuc/"/>
        <id>https://nbari.com/vm-bhyve-inuc/</id>
        
        <summary type="html">&lt;p&gt;Install &lt;code&gt;vm-bhyve&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pkg install vm-bhyve&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</summary>
        
    </entry>
    <entry xml:lang="en">
        <title>FreeBSD dedibox setup</title>
        <published>2022-08-27T19:17:42+00:00</published>
        <updated>2022-08-27T19:17:42+00:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/freebsd-zfs-dedibox/"/>
        <id>https://nbari.com/freebsd-zfs-dedibox/</id>
        
        <content type="html" xml:base="https://nbari.com/freebsd-zfs-dedibox/">&lt;p&gt;Boot server in rescue mode and select FreeBSD rescue image, after login fetch sources:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# cd /tmp&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# fetch http://ftp.freebsd.org/pub/FreeBSD/releases/amd64/13.1-RELEASE/base.txz&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# fetch http://ftp.freebsd.org/pub/FreeBSD/releases/amd64/13.1-RELEASE/kernel.txz&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Destroy existing partitions, for example:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gpart destroy -F ada0&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Install using something like this:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;#!/bin/sh&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PASSWORD&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;fabrik&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;USER&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;devops&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ZPOOL&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;zroot&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mddev&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;ada0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;gpart&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; create -s gpt&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; ${&lt;/span&gt;&lt;span&gt;mddev&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;gpart&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; add -a 4k -s 512k -t freebsd-boot&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; ${&lt;/span&gt;&lt;span&gt;mddev&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;gpart&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; bootcode -b /boot/pmbr -p /boot/gptzfsboot -i&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 1&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; ${&lt;/span&gt;&lt;span&gt;mddev&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;gpart&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; add -a 1m -t freebsd-zfs -l disk0&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; ${&lt;/span&gt;&lt;span&gt;mddev&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;sysctl&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; vfs.zfs.min_auto_ashift=&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;12&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;set&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -v&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;zpool&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; create -o cachefile=/tmp/&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;${&lt;/span&gt;&lt;span&gt;ZPOOL&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;.cache -o altroot=/mnt -o autoexpand=on -O compress=lz4 -O atime=off&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; ${&lt;/span&gt;&lt;span&gt;ZPOOL&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; /dev/gpt/disk0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;zfs&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; create -V 1G -o org.freebsd:swap=on -o checksum=off -o compression=off -o dedup=off -o sync=disabled -o primarycache=none&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; ${&lt;/span&gt;&lt;span&gt;ZPOOL&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;/swap&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;zfs&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; create -o mountpoint=none&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; ${&lt;/span&gt;&lt;span&gt;ZPOOL&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;/ROOT&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;zfs&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; create -o mountpoint=/&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; ${&lt;/span&gt;&lt;span&gt;ZPOOL&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;/ROOT/default&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;zfs&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; create -o mountpoint=/tmp -o exec=off -o setuid=off&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; ${&lt;/span&gt;&lt;span&gt;ZPOOL&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;/tmp&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;zfs&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; create -o mountpoint=/usr -o canmount=off&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; ${&lt;/span&gt;&lt;span&gt;ZPOOL&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;/usr&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;zfs&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; create -o exec=off -o setuid=off -o compression=lz4&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; ${&lt;/span&gt;&lt;span&gt;ZPOOL&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;/usr/doc&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;zfs&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; create&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; ${&lt;/span&gt;&lt;span&gt;ZPOOL&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;/usr/home&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;zfs&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; create&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; ${&lt;/span&gt;&lt;span&gt;ZPOOL&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;/usr/obj&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;zfs&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; create&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; ${&lt;/span&gt;&lt;span&gt;ZPOOL&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;/usr/local&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;zfs&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; create -o setuid=off -o compression=lz4&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; ${&lt;/span&gt;&lt;span&gt;ZPOOL&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;/usr/ports&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;zfs&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; create -o setuid=off -o compression=off&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; ${&lt;/span&gt;&lt;span&gt;ZPOOL&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;/usr/ports/distfiles&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;zfs&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; create -o setuid=off -o compression=off&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; ${&lt;/span&gt;&lt;span&gt;ZPOOL&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;/usr/ports/packages&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;zfs&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; create -o exec=off -o setuid=off -o compression=lz4&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; ${&lt;/span&gt;&lt;span&gt;ZPOOL&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;/usr/src&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;zfs&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; create -o mountpoint=/var -o canmount=off&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; ${&lt;/span&gt;&lt;span&gt;ZPOOL&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;/var&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;zfs&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; create -o exec=off -o setuid=off&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; ${&lt;/span&gt;&lt;span&gt;ZPOOL&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;/var/audit&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;zfs&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; create -o exec=off -o setuid=off -o compression=lz4&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; ${&lt;/span&gt;&lt;span&gt;ZPOOL&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;/var/crash&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;zfs&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; create&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; ${&lt;/span&gt;&lt;span&gt;ZPOOL&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;/var/db&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;zfs&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; create -o setuid=off -o compression=lz4&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; ${&lt;/span&gt;&lt;span&gt;ZPOOL&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;/var/db/pkg&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;zfs&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; create -o exec=off -o setuid=off -o compression=lz4&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; ${&lt;/span&gt;&lt;span&gt;ZPOOL&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;/var/log&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;zfs&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; create -o exec=off -o setuid=off -o readonly=on&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; ${&lt;/span&gt;&lt;span&gt;ZPOOL&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;/var/empty&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;zfs&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; create -o atime=on -o exec=off -o setuid=off -o compression=gzip&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; ${&lt;/span&gt;&lt;span&gt;ZPOOL&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;/var/mail&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;zfs&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; create&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; ${&lt;/span&gt;&lt;span&gt;ZPOOL&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;/var/spool&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;zfs&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; create -o exec=off -o setuid=off -o compression=gzip&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; ${&lt;/span&gt;&lt;span&gt;ZPOOL&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;/var/spool/clientmqueue&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;zfs&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; create -o setuid=off -o compression=lz4&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; ${&lt;/span&gt;&lt;span&gt;ZPOOL&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;/var/tmp&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;zfs&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; create&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; ${&lt;/span&gt;&lt;span&gt;ZPOOL&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;/var/ports&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;zfs&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; create -o mountpoint=/jails&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; ${&lt;/span&gt;&lt;span&gt;ZPOOL&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;/jails&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;zfs&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; create&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; ${&lt;/span&gt;&lt;span&gt;ZPOOL&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;/jails/base&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;zfs&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; create -o exec=off -o setuid=off&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; ${&lt;/span&gt;&lt;span&gt;ZPOOL&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;/jails/base/tmp&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;zfs&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; set quota=10G&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; ${&lt;/span&gt;&lt;span&gt;ZPOOL&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;/jails/base&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;zpool&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; set bootfs=&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;${&lt;/span&gt;&lt;span&gt;ZPOOL&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;/ROOT/default&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; ${&lt;/span&gt;&lt;span&gt;ZPOOL&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;/usr/bin/tar&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -C /mnt -x -f /tmp/base.txz&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;/usr/bin/tar&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -C /mnt -x -f /tmp/kernel.txz&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;chroot&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; /mnt pw useradd&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; ${&lt;/span&gt;&lt;span&gt;USER&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -m -G wheel -s /bin/csh -h&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 0&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;lt;&amp;lt;EOP&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;${&lt;/span&gt;&lt;span&gt;PASSWORD&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;EOP&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;touch&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; /mnt/etc/fstab&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;# /boot/loader.conf&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;cat&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;lt;&amp;lt; EOF &amp;gt;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; /mnt/boot/loader.conf&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;autoboot_delay=&amp;quot;-1&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;beastie_disable=&amp;quot;YES&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;boot_multicons=&amp;quot;YES&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;console=&amp;quot;comconsole,vidconsole&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;hw.broken_txfifo=&amp;quot;1&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;hw.memtest.test=&amp;quot;0&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;hw.vtnet.mq_disable=&amp;quot;1&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;kern.geom.label.disk_ident.enable=&amp;quot;0&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;kern.geom.label.gptid.enable=&amp;quot;0&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;zfs_load=&amp;quot;YES&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;EOF&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;# /etc/rc.conf&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;cat&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;lt;&amp;lt; EOF &amp;gt;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; /mnt/etc/rc.conf&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;zfs_enable=&amp;quot;YES&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;gateway_enable=&amp;quot;YES&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;hostname=&amp;quot;fabrik&amp;quot; # change to your desired hostname&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;ifconfig_DEFAULT=&amp;quot;SYNCDHCP&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;clear_tmp_enable=&amp;quot;YES&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;dumpdev=&amp;quot;NO&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;ntpd_enable=&amp;quot;YES&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;ntpd_sync_on_start=&amp;quot;YES&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;sendmail_enable=&amp;quot;NONE&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;sshd_enable=&amp;quot;YES&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;syslogd_flags=&amp;quot;-ssC&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;EOF&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;cp&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; /tmp/&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;${&lt;/span&gt;&lt;span&gt;ZPOOL&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;.cache /mnt/boot/zfs/zpool.cache&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;zpool&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; export&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; ${&lt;/span&gt;&lt;span&gt;ZPOOL&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Reboot and in the https://panel.op-net.com/ set server back to boot in normal mode&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>mi 360 2K (NAS)</title>
        <published>2022-07-09T10:11:36+00:00</published>
        <updated>2022-07-09T10:11:36+00:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/mi-nas/"/>
        <id>https://nbari.com/mi-nas/</id>
        
        <content type="html" xml:base="https://nbari.com/mi-nas/">&lt;p&gt;The Mi Home Security Camera (Xiaomi), only supports SMB1,add this to your
&lt;code&gt;smb4.conf&lt;/code&gt; to make it work:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[global]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    client max protocol = NT1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    server min protocol = NT1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ntlm auth = ntlmv1-permitted&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>removing metadata</title>
        <published>2022-06-06T11:26:52+00:00</published>
        <updated>2022-06-06T11:26:52+00:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/removing-metadata/"/>
        <id>https://nbari.com/removing-metadata/</id>
        
        <content type="html" xml:base="https://nbari.com/removing-metadata/">&lt;p&gt;To remove metadata from images:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; convert image.jpeg -strip newimage.jpg&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If want to resize:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; convert image.jpg -resize=400 -quality 70% -strip newimage.jpg&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>mysql disable binary logs</title>
        <published>2022-06-04T15:49:37+00:00</published>
        <updated>2022-06-04T15:49:37+00:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/mysql-disable-binlog/"/>
        <id>https://nbari.com/mysql-disable-binlog/</id>
        
        <content type="html" xml:base="https://nbari.com/mysql-disable-binlog/">&lt;p&gt;If need to temporarily disable binary logs because of a huge load/dump:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;systemctl&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; set-environment MYSQLD_OPTS=&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;--skip-log-bin=1&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then restart;&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;systemctl&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; restart mariadb&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Verify:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;MariaDB&amp;gt; select @@log_bin;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+-----------+&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;| @@log_bin |&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+-----------+&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|         0 |&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+-----------+&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To remove the environment var:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;systemctl&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; unset-environment MYSQLD_OPTS&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>yubikey</title>
        <published>2022-05-28T15:00:32+00:00</published>
        <updated>2022-05-28T15:00:32+00:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/yubikey/"/>
        <id>https://nbari.com/yubikey/</id>
        
        <content type="html" xml:base="https://nbari.com/yubikey/">&lt;p&gt;Install ykman:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;brew&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; install ykman&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Configure your 2 slot for static password:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;ykman&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; otp static&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 2&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; --keyboard-layout US&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This will prompt you to enter the password you want to store in the slot but default adding the enter key at the end of the password. If you want to avoid that just add &lt;code&gt;--no-enter&lt;/code&gt; flag, for example you can use:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;ykman&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; otp static&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 2&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; --keyboard-layout US&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;your password&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; --no-enter&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;The &lt;code&gt;--keyboard-layout US&lt;/code&gt; is to prevent getting &lt;code&gt;Error: Unsupported character: xxx&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;You can also use the &lt;code&gt;--pacing&lt;/code&gt; flag to add a delay between each character, for example:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;ykman&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; otp settings&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 2&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; --pacing&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 60&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;reset-pin&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#reset-pin&quot; aria-label=&quot;Anchor link for: reset-pin&quot;&gt;🔗&lt;/a&gt;reset pin&lt;/h2&gt;
&lt;p&gt;To reset all data:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; ykman piv reset&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;WARNING!&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; This will delete all stored PIV data and restore factory settings. Proceed?&lt;/span&gt;&lt;span&gt; [y/N]: y&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;Resetting&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; PIV data...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;Success!&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; All PIV data have been cleared from the YubiKey.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;Your&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; YubiKey now has the default PIN, PUK and Management Key:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;        PIN:&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;    123456&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;        PUK:&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;    12345678&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;        Management&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; Key:&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 010203040506070801020304050607080102030405060708&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Change the PIN from 123456 to 654321:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;ykman&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; piv access change-pin --pin&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 123456&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; --new-pin&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 654321&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Change the PUK&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;ykman&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; piv change-puk&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Generate a random management key and store it on the device, protected with the PIN.&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;ykman&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; piv change-management-key --generate --protect&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;gpg&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#gpg&quot; aria-label=&quot;Anchor link for: gpg&quot;&gt;🔗&lt;/a&gt;GPG&lt;/h2&gt;
&lt;p&gt;To reset all GPG data:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;ykman&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; openpgp reset&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Set the Admin and pin using:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; gpg --edit-card&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;gpg/card&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; admin&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;Admin&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; commands are allowed&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;gpg/card&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;passwd&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To use the key in another system just import the public key and trust it:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; curl -sSL https://github.com/nbari.gpg&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; |&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt; gpg&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; --import&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; gpg --edit-key nbari@tequila.io&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;trust&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;5&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;save&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Restart the gpg-agent:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;gpgconf&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; --kill gpg-agent&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;gpgconf&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; --kill scdaemon&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;Remove password from gpg key to import it to yubikey.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Check: https://developers.yubico.com/PGP/Importing_keys.html&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>aws-vault</title>
        <published>2022-04-27T10:28:08+00:00</published>
        <updated>2022-04-27T10:28:08+00:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/aws-vault/"/>
        <id>https://nbari.com/aws-vault/</id>
        
        <content type="html" xml:base="https://nbari.com/aws-vault/">&lt;p&gt;If using &lt;code&gt;vault&lt;/code&gt; with &lt;code&gt;aws&lt;/code&gt; secrets, you can request a pair of keys using:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;$ vault&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; read aws/creds/readonly&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;Key&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;                Value&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;---&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;                -----&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;lease_id&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;           aws/creds/readonly/BMRZyGlcUof2S71rgBpHamfE&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;lease_duration&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;     12h&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;lease_renewable&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;    true&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;access_key&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;         AKIBVIJBTT64DFFGWVNV&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;secret_key&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;         p1zzZdDbZ0GGe7azIBq/5GrQwsHRege6UhTfr59a&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;security_token&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;     &amp;lt;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;ni&lt;/span&gt;&lt;span&gt;l&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If you would like to login via web using a Console password, install
https://github.com/99designs/aws-vault&lt;/p&gt;
&lt;p&gt;Add your pair of keys:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; aws-vault add monkey&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;Enter&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; Access Key ID:&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You may need to previously export the AWS region:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; export AWS_REGION=us-east-2&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then to login run:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; aws-vault login monkey&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;For this to work the AWS policy assigned to your keys needs to allow the to
create a token, for example here a read only:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;hcl&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;resource&lt;/span&gt;&lt;span&gt; &amp;quot;vault_aws_secret_backend_role&amp;quot; &amp;quot;role&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  backend&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;         =&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; vault_aws_secret_backend&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span&gt;aws&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span&gt;path&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  name&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;            = &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;readonly&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  credential_type&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; = &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;iam_user&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  policy_arns&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;     = [&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;arn:aws:iam::aws:policy/ReadOnlyAccess&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  policy_document&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; = &amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;EOT&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;  &amp;quot;Version&amp;quot;: &amp;quot;2012-10-17&amp;quot;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;  &amp;quot;Statement&amp;quot;: [&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;    {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;      &amp;quot;Effect&amp;quot;: &amp;quot;Allow&amp;quot;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;      &amp;quot;Action&amp;quot;: &amp;quot;sts:GetFederationToken&amp;quot;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;      &amp;quot;Resource&amp;quot;: &amp;quot;*&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;    }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;  ]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;EOT&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>vault bootstrap</title>
        <published>2022-04-20T17:02:45+00:00</published>
        <updated>2022-04-20T17:02:45+00:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/vault-bootstrap/"/>
        <id>https://nbari.com/vault-bootstrap/</id>
        
        <content type="html" xml:base="https://nbari.com/vault-bootstrap/">&lt;p&gt;Create an admin policy &lt;code&gt;admin-policy.hcl&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;hcl&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;# Allow managing leases&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;path &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;sys/leases/*&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  capabilities&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; =&lt;/span&gt;&lt;span&gt; [&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;create&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;read&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;update&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;delete&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;list&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;# Read system health check&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;path &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;sys/health&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  capabilities&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; =&lt;/span&gt;&lt;span&gt; [&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;read&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;# Create and manage ACL policies broadly across Vault&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;# List existing policies&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;path &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;sys/policies/acl&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  capabilities&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; =&lt;/span&gt;&lt;span&gt; [&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;list&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;# Create and manage ACL policies&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;path &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;sys/policies/acl/*&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  capabilities&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; =&lt;/span&gt;&lt;span&gt; [&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;create&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;read&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;update&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;delete&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;list&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;# Manage auth methods broadly across Vault&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;path &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;auth/*&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  capabilities&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; =&lt;/span&gt;&lt;span&gt; [&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;create&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;read&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;update&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;delete&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;list&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;# Create, update, and delete auth methods&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;path &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;sys/auth/*&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  capabilities&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; =&lt;/span&gt;&lt;span&gt; [&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;create&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;update&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;delete&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;# List auth methods&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;path &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;sys/auth&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  capabilities&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; =&lt;/span&gt;&lt;span&gt; [&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;read&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;# Enable and manage the key/value secrets engine at  path&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;# List, create, update, and delete key/value secrets&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;path &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;secret/*&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  capabilities&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; =&lt;/span&gt;&lt;span&gt; [&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;create&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;read&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;update&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;delete&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;list&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;# Manage secrets engines&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;path &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;sys/mounts/*&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  capabilities&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; =&lt;/span&gt;&lt;span&gt; [&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;create&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;read&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;update&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;delete&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;list&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;# List existing secrets engines.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;path &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;sys/mounts&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  capabilities&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; =&lt;/span&gt;&lt;span&gt; [&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;read&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Load the policy:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; vault policy write admin admin-policy.hcl&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Enable GitHub:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; vault auth enable github&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Allow only your organization:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; vault write auth/github/config organization=myorg&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Add the &lt;code&gt;admin-policy&lt;/code&gt; to a team in your GitHub org named &lt;code&gt;devops&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; vault write auth/github/map/teams/devops value=admin&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Change the default lease time:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; vault auth tune -default-lease-ttl=72h github/&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Login using your GitHub Token&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;#!/bin/sh&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;unset&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; ADMIN_TOKEN&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-8&quot;&gt;export&lt;/span&gt;&lt;span&gt; ADMIN_TOKEN&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=$(&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;vault&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; login -method=github token=ghp_ABC -format=json&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; |&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;  jq&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -r&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;.auth.client_token&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Lookup:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; vault token lookup&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;adding-auth-aws&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#adding-auth-aws&quot; aria-label=&quot;Anchor link for: adding-auth-aws&quot;&gt;🔗&lt;/a&gt;Adding auth AWS&lt;/h2&gt;
&lt;p&gt;Use path &lt;code&gt;my-project&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; vault auth enable -path=my-project aws&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Add AWS secret key:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; vault write auth/my-project/config/client secret_key=SECRET_KEY access_key=ACCESS_KEY&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Create a policy for only read and and only allow a VPC:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;hcl&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;vault policy write &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;my-project-ro&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; -&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;EOF&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;path &amp;quot;secret/my-project/*&amp;quot; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;  capabilities = [&amp;quot;read&amp;quot;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;EOF&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;vault write \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  auth&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;/&lt;/span&gt;&lt;span&gt;my&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;-&lt;/span&gt;&lt;span&gt;project&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;/&lt;/span&gt;&lt;span&gt;role&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;/&lt;/span&gt;&lt;span&gt;my&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;-&lt;/span&gt;&lt;span&gt;project \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  auth_type&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&lt;/span&gt;&lt;span&gt;ec2 \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  policies&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&lt;/span&gt;&lt;span&gt;my&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;-&lt;/span&gt;&lt;span&gt;project&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;-&lt;/span&gt;&lt;span&gt;ro \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  max_ttl&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&lt;/span&gt;&lt;span&gt;5m \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  bound_vpc_id&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&lt;/span&gt;&lt;span&gt;vpc&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;-&lt;/span&gt;&lt;span&gt;XXX&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Create a &lt;code&gt;kv&lt;/code&gt; secrets version 1:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; vault secrets enable -path=secret/my-project -version=1 kv&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>mTLS Browser </title>
        <published>2022-04-18T12:20:45+00:00</published>
        <updated>2022-04-18T12:20:45+00:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/mtls-browser/"/>
        <id>https://nbari.com/mtls-browser/</id>
        
        <content type="html" xml:base="https://nbari.com/mtls-browser/">&lt;p&gt;To use &lt;a rel=&quot;external&quot; href=&quot;https://developers.cloudflare.com/cloudflare-one/identity/devices/mutual-tls-authentication/&quot;&gt;mTLS&lt;/a&gt; from your browser, first convert the cert to p12 format:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; openssl pkcs12 -export -in server.crt -inkey server.key -out server.p12&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;For MacOS you need to add an export password&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Then import the &lt;code&gt;server.p12&lt;/code&gt; in to keychain or Firefox, example:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/img/mtls-firefox.png&quot; alt=&quot;mtls-firefox&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Delete your Active logins to test:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/img/mtls-firefox2.png&quot; alt=&quot;mtls-firefox&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>vault SSH</title>
        <published>2022-04-16T15:59:30+00:00</published>
        <updated>2022-04-16T15:59:30+00:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/vault-ssh/"/>
        <id>https://nbari.com/vault-ssh/</id>
        
        <content type="html" xml:base="https://nbari.com/vault-ssh/">&lt;p&gt;Vault &lt;code&gt;SSH&lt;/code&gt; Secrets Engine&lt;/p&gt;
&lt;p&gt;Enable the ssh engine:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; vault secrets enable ssh&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;or chosse a path:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; vault secrets enable -path=ssh-client-signer ssh&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Configure Vault with a CA for signing client keys using the &lt;code&gt;/config/ca&lt;/code&gt; endpoint:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; vault write ssh/config/ca generate_signing_key=&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;true&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Get the public key:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; curl -s&lt;/span&gt;&lt;span&gt; $VAULT_ADDR&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;/v1/ssh/public_key&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Copy the key to your servers and add this to &lt;code&gt;sshd_config&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;TrustedUserCAKeys /etc/ssh/truasted-ca.pem&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;AuthorizedKeysFile /dev/null&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PasswordAuthentication no&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ChallengeResponseAuthentication no&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Create a role:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; vault write ssh/roles/default -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;lt;&amp;lt;&amp;quot;EOH&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;  &amp;quot;algorithm_signer&amp;quot;: &amp;quot;rsa-sha2-256&amp;quot;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;  &amp;quot;allow_user_certificates&amp;quot;: true,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;  &amp;quot;allowed_users&amp;quot;: &amp;quot;*&amp;quot;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;  &amp;quot;allowed_extensions&amp;quot;: &amp;quot;permit-pty,permit-port-forwarding,permit-agent-forwarding&amp;quot;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;  &amp;quot;default_extensions&amp;quot;: [&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;    {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;      &amp;quot;permit-pty&amp;quot;: &amp;quot;&amp;quot;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;      &amp;quot;permit-port-forwarding&amp;quot;: &amp;quot;&amp;quot;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;      &amp;quot;permit-agent-forwarding&amp;quot;: &amp;quot;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;    }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;  ],&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;  &amp;quot;key_type&amp;quot;: &amp;quot;ca&amp;quot;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;  &amp;quot;default_user&amp;quot;: &amp;quot;devops&amp;quot;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;  &amp;quot;ttl&amp;quot;: &amp;quot;30m0s&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;EOH&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Ask Vault to sign your public key.&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; vault write -field=signed_key ssh/sign/default public_key=@&lt;/span&gt;&lt;span&gt;$HOME&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;/.ssh/id_rsa.pub&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;gt;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; ~/.ssh/id_rsa-cert.pub&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;For a specific user:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; vault write -field=signed_key ssh/sign/default public_key=@&lt;/span&gt;&lt;span&gt;$HOME&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;/.ssh/id_rsa.pub valid_principals=nbari&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;gt;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; ~/.ssh/id_rsa-cert.pub&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;If you are saving the certificate directly beside your SSH keypair, suffix the
name with -cert.pub (~/.ssh/id_rsa-cert.pub). With this naming scheme, OpenSSH
will automatically use it during authentication.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Examine the signed certificate:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; ssh-keygen -Lf ~/.ssh/id_rsa-cert.pub&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Test:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; ssh -i id_rsa_cert.pub -i id_rsa username@host&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>vm-bhyve Pfsense</title>
        <published>2021-12-30T15:24:46+01:00</published>
        <updated>2021-12-30T15:24:46+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/vm-bhyve-pfsense/"/>
        <id>https://nbari.com/vm-bhyve-pfsense/</id>
        
        <summary type="html">&lt;p&gt;Install &lt;code&gt;vm-bhyve&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pkg add https://pkg.freebsd.org/FreeBSD:12:amd64/latest/All/vm-bhyve-1.4.2.pkg&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pkg add https://pkg.freebsd.org/FreeBSD:12:amd64/latest/All/uefi-edk2-bhyve-g20210226,2.pkg&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pkg add https://pkg.freebsd.org/FreeBSD:12:amd64/latest/All/uefi-edk2-bhyve-csm-0.2_3,1.pkg&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pkg add https://pkg.freebsd.org/FreeBSD:12:amd64/latest/All/bhyve-firmware-1.0_1.pkg&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</summary>
        
    </entry>
    <entry xml:lang="en">
        <title>vncserver</title>
        <published>2021-12-26T18:24:24+01:00</published>
        <updated>2021-12-26T18:24:24+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/vncserver/"/>
        <id>https://nbari.com/vncserver/</id>
        
        <content type="html" xml:base="https://nbari.com/vncserver/">&lt;p&gt;To start &lt;code&gt;vncserver&lt;/code&gt; and listen connections from anywhere:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;vncserver&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -localhost no :1&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>GPG RemoteForward</title>
        <published>2021-12-08T20:56:49+01:00</published>
        <updated>2021-12-08T20:56:49+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/gpg-remoteforward/"/>
        <id>https://nbari.com/gpg-remoteforward/</id>
        
        <content type="html" xml:base="https://nbari.com/gpg-remoteforward/">&lt;p&gt;To Forward your SSH session if using a Yubikey and &lt;code&gt;gpg-agent&lt;/code&gt;:&lt;/p&gt;
&lt;p&gt;For example to connect from a MacOS to a Linux VM:&lt;/p&gt;
&lt;p&gt;On the client, add this to your &lt;code&gt;~/.ssh/config&lt;/code&gt;&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;Host&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; foo&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;    Hostname&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; X.X.X.X&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;    ForwardAgent&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; yes&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;    RemoteForward&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; /run/user/1000/gnupg/S.gpg-agent     /Users/monkey/.gnupg/S.gpg-agent.extra&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;    RemoteForward&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; /run/user/1000/gnupg/S.gpg-agent.ssh /Users/monkey/.gnupg/S.gpg-agent.extra.ssh&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                            (&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;remote&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; socket&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;)                  (&lt;/span&gt;&lt;span&gt;l&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;ocal socket&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To find the local socket in your mac/client do:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;gpgconf&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; --list-dirs agent-extra-socket&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To find the remove socket, in the Linux VM, do:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;gpgconf&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; --list-dirs agent-socket&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In the remote host (the Linux VM) in &lt;code&gt;.bashrc&lt;/code&gt; I have:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;gpgconf&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; --create-socketdir&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If can&#39;t login, remove the socket: &lt;code&gt;rm -f /run/user/1000/gnupg/S.gpg-agent&lt;/code&gt;, if posible add this to the /etc/ssh/sshd_config: &lt;code&gt;StreamLocalBindUnlink yes&lt;/code&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Optional If you do not have root access to the remote machine to edit /etc/ssh/sshd_config, you will need to remove the socket (located at gpgconf --list-dir agent-socket) on the remote machine before forwarding works. For example, rm /run/user/1000/gnupg/S.gpg-agent - https://github.com/drduh/YubiKey-Guide#remote-machines-gpg-agent-forwarding&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Add your public key to the remove host:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;gpg&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -a -o pub.key --export your@key&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In the remote host import your key and trust it:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;gpg&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; --import pub.key&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;gpg&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; --edit-key KEYID&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;trust&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;5&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;save&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You could also use:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;ssh&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -R /run/user/1000/gnupg/S.gpg-agent:/Users/monkey/.gnupg/S.gpg-agent.extra -o&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;StreamLocalBindUnlink=yes&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; user@x.x.x.x&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In the remote host test with something like:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;ssh&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -T git@github.com&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Also you could list all your current keys with:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;ssh-add&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -L&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;scdaemon-conf&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#scdaemon-conf&quot; aria-label=&quot;Anchor link for: scdaemon-conf&quot;&gt;🔗&lt;/a&gt;scdaemon.conf&lt;/h2&gt;
&lt;p&gt;In macOS, you can use the following &lt;code&gt;~/.gnupg/scdaemon.conf&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pcsc-driver /System/Library/Frameworks/PCSC.framework/PCSC&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;disable-ccid&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;log-file /tmp/scdaemon.log&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In Linux:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pcsc-driver /usr/lib/libpcsclite.so&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;disable-ccid&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;log-file /tmp/scdaemon.log&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;you may need to install &lt;code&gt;libusb-compat&lt;/code&gt; to use &lt;code&gt;libpcsclite.so&lt;/code&gt; on some systems&lt;/p&gt;
&lt;/blockquote&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>DTrace</title>
        <published>2021-09-05T20:44:01+02:00</published>
        <updated>2021-09-05T20:44:01+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/dtrace/"/>
        <id>https://nbari.com/dtrace/</id>
        
        <content type="html" xml:base="https://nbari.com/dtrace/">&lt;p&gt;To enable ensure kernel is compiled with:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;makeoptions     DEBUG=-g                # Build kernel with gdb(1) debug symbols&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;makeoptions     WITH_CTF=1              # Run ctfconvert(1) for DTrace support&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;options         KDTRACE_FRAME           # Ensure frames are compiled in&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;options         KDTRACE_HOOKS           # Kernel DTrace hooks&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;options         DDB_CTF                 # Kernel ELF linker loads CTF data&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Build kernel, reboot:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;kldload dtraceall&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To check for example &lt;code&gt;redis-server&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dtrace -x ustackframes=100 -n &amp;#39;profile-197 /execname == &amp;quot;redis-server&amp;quot; &amp;amp;&amp;amp; arg1/ {@[ustack()] = count(); } tick-60s { exit(0); }&amp;#39; -o out.stacks&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;if you do a &lt;code&gt;dtrace -l&lt;/code&gt; will find:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;47296    profile    profile-197&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;47297    profile    tick-60s&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;47298    profile    tick-10s&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;47299    profile    profile-99&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;arg1&lt;/code&gt; is for user land, &lt;code&gt;arg0&lt;/code&gt; for the kernel.&lt;/p&gt;
&lt;p&gt;To sample the kernel:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dtrace -x stackframes=100 -n &amp;#39;profile-197 /arg0/ { @[stack()] = count(); } tick-60s { exit(0); }&amp;#39; -o out.stacks&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;to create a flame graph:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;git clone https://github.com/brendangregg/FlameGraph&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cd FlameGraph&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;./stackcollapse.pl out.stacks &amp;gt; out.folded&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;./flamegraph.pl out.folded &amp;gt; out.svg&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Check https://www.brendangregg.com/FlameGraphs/cpuflamegraphs.html&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>pkg.txz.pubkeysig</title>
        <published>2021-07-27T13:39:04+02:00</published>
        <updated>2021-07-27T13:39:04+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/pkg-txz-pubkeysig/"/>
        <id>https://nbari.com/pkg-txz-pubkeysig/</id>
        
        <content type="html" xml:base="https://nbari.com/pkg-txz-pubkeysig/">&lt;p&gt;If &lt;code&gt;pkg&lt;/code&gt; can&#39;t be installed because missing &lt;code&gt;pkg.txz.pubkeysig&lt;/code&gt;, try this:&lt;/p&gt;
&lt;p&gt;Go to &lt;code&gt;/usr/local/poudriere/data/packages/13amd64-default/.latest/Latest&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;echo -n &amp;quot;$(sha256 -q pkg.txz)&amp;quot; | openssl dgst -sha256 -sign /usr/local/etc/ssl/keys/pkg.key -binary -out ./pkg.txz.pubkeysig&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Bhyve Ubuntu</title>
        <published>2021-06-02T21:41:06+02:00</published>
        <updated>2021-06-02T21:41:06+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/bhyve-ubuntu/"/>
        <id>https://nbari.com/bhyve-ubuntu/</id>
        
        <content type="html" xml:base="https://nbari.com/bhyve-ubuntu/">&lt;p&gt;In &lt;code&gt;/etc.rc.conf&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cloned_interfaces=&amp;quot;lo1 bridge0 tap0&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;config_lo1=&amp;quot;inet 127.0.1.1/8&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;autobridge_interfaces=&amp;quot;bridge0&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;autobridge_bridge0=&amp;quot;tap* igb0&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ifconfig_bridge0=&amp;quot;addm igb0 addm tap0 up description bhyve&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In &lt;code&gt;/boot/loader.conf&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;vmm_load=&amp;quot;YES&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;nmdm_load=&amp;quot;YES&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Check that you have:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sysctl net.link.tap.up_on_open=1&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Create the volume:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;zfs create -V100G -o volmode=dev tank/ubuntuvm&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Install:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pkg install uefi-edk2-bhyve&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;this will create /usr/local/share/uefi-firmware/BHYVE_UEFI.fd&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Setup and install:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;bhyve -AHP -w \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-s 1:0,lpc \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-s 2:0,virtio-net,tap0 \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-s 3:0,ahci-cd,/tank/iso/ubuntu-20.04.2-live-server-amd64.iso \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-s 4:0,virtio-blk,/dev/zvol/tank/ubuntuvm \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-s 29,fbuf,tcp=0.0.0.0:5900,w=800,h=600,wait \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-c 4 -m 8G ubuntu&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Install when ask to reboot, destroy the vm:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;bhyvectl --destroy --vm=ubuntu&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then to start just remove the CD &lt;code&gt;ahci-cd&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;while true; do&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;bhyve -AHP -w \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-s 1:0,lpc \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-s 2:0,virtio-net,tap0 \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-s 4:0,virtio-blk,/dev/zvol/tank/ubuntuvm \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-s 29,fbuf,tcp=0.0.0.0:5900,w=800,h=600,wait \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-c 4 -m 8G ubuntu&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;bhyve_exit=$?&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;if [ $bhyve_exit -ne 0 ]; then&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    break&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;fi&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;done&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;/usr/sbin/bhyvectl --destroy --vm=ubuntu&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;debian&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#debian&quot; aria-label=&quot;Anchor link for: debian&quot;&gt;🔗&lt;/a&gt;debian&lt;/h2&gt;
&lt;p&gt;Boot using EFI file grupx64.efi then:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cp /boot/efi/EFI/debian/grubx64.efi /boot/efi/EFI/BOOT/bootx64.efi&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To connect using the VNC client you can install it using this cask:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;brew install --cask vnc-viewer&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;More info:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;https://docs.freebsd.org/doc/13.0-RELEASE/usr/local/share/doc/freebsd/handbook/virtualization-host-bhyve.html&lt;/li&gt;
&lt;li&gt;https://www.cyberciti.biz/faq/how-to-install-linux-vm-on-freebsd-using-bhyve-and-zfs/&lt;/li&gt;
&lt;/ul&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>mail.rc</title>
        <published>2021-05-22T19:49:23+02:00</published>
        <updated>2021-05-22T19:49:23+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/mail-rc/"/>
        <id>https://nbari.com/mail-rc/</id>
        
        <content type="html" xml:base="https://nbari.com/mail-rc/">&lt;p&gt;When using AWS SES if trying to send mail to root you could get something like:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;554 Transaction failed: Missiong final &amp;#39;@domain&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;AWS requires that the FROM and TO have a @domain so need to modify
&lt;code&gt;/etc/mail.rc&lt;/code&gt; and add the alias like:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;alias root root&amp;lt;root@your.tld&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>vultr shutdown -o -n -r now</title>
        <published>2021-05-21T20:17:41+02:00</published>
        <updated>2021-05-21T20:17:41+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/vultr-shutdown-o-n/"/>
        <id>https://nbari.com/vultr-shutdown-o-n/</id>
        
        <content type="html" xml:base="https://nbari.com/vultr-shutdown-o-n/">&lt;p&gt;To prevent the system to hang on &quot;detaching uhub0&quot; reboot using the flag &lt;code&gt;-n&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;shutdown -o -n -r now&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>pip upgrade</title>
        <published>2021-05-05T07:55:26+02:00</published>
        <updated>2021-05-05T07:55:26+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/pip-upgrade/"/>
        <id>https://nbari.com/pip-upgrade/</id>
        
        <content type="html" xml:base="https://nbari.com/pip-upgrade/">&lt;p&gt;Upgrade using:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pip list --outdated --format=freeze | grep -v &amp;#39;^\-e&amp;#39; | cut -d = -f 1 | xargs -n1 pip3 install --upgrade --user&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>gpg: selecting card failed: Operation not supported by device</title>
        <published>2021-04-27T20:24:49+02:00</published>
        <updated>2021-04-27T20:24:49+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/gpg-selecting-card-failed-operation-not-supported-by-device/"/>
        <id>https://nbari.com/gpg-selecting-card-failed-operation-not-supported-by-device/</id>
        
        <content type="html" xml:base="https://nbari.com/gpg-selecting-card-failed-operation-not-supported-by-device/">&lt;p&gt;If using a yubikey and getting this:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gpg: selecting card failed: Operation not supported by device&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gpg: OpenPGP card not available: Operation not supported by device&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Add to &lt;code&gt;~/.gnupg/scdaemon.conf&lt;/code&gt;&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;disable-ccid&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To debug you could use:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;reader-port Yubico Yubi&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;debug-all&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;debug-level guru&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;disable-ccid&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;log-file /tmp/scd.log&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Pipenv Pyinstaller</title>
        <published>2021-04-24T16:25:34+02:00</published>
        <updated>2021-04-24T16:25:34+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/pipenv-pyinstaller/"/>
        <id>https://nbari.com/pipenv-pyinstaller/</id>
        
        <content type="html" xml:base="https://nbari.com/pipenv-pyinstaller/">&lt;p&gt;Create a basic &lt;code&gt;hello world&lt;/code&gt; using flask:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mkdir /tmp/project&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cd /tmp/project&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Create &lt;code&gt;app.py&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;from flask import Flask&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;app = Flask(__name__)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;@app.route(&amp;quot;/&amp;quot;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def hello():&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return &amp;#39;Hello World!&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;if __name__ == &amp;#39;__main__&amp;#39;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    app.run(host=&amp;#39;0.0.0.0&amp;#39;)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Instal flask:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; pipenv install flask&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;test the app:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pipenv shell&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;python app.py&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Install &lt;code&gt;pyinstaller&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pipenv install pyinstaller&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Create the &lt;code&gt;requirements.txt&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pipenv run pip freeze &amp;gt; requirements.txt&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Create the binary:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; pyinstaller --onefile app.py&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Test &amp;amp; run:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;./dist/app&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Done :-)&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>ZFS encryption</title>
        <published>2021-04-22T10:52:20+02:00</published>
        <updated>2021-04-22T10:52:20+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/zfs-encryption/"/>
        <id>https://nbari.com/zfs-encryption/</id>
        
        <content type="html" xml:base="https://nbari.com/zfs-encryption/">&lt;p&gt;Create an encrypted file system:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;zfs create -o encryption=on -o keyformat=passphrase -o keylocation=prompt tank/test-enc&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Check encryption:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ zfs get encryption tank/test-enc&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;NAME           PROPERTY    VALUE        SOURCE&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;tank/test-enc  encryption  aes-256-gcm  -&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Check status:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;zfs get -p encryption,keystatus,keyformat,keylocation,encryptionroot&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>ssh comment</title>
        <published>2021-04-17T17:32:34+02:00</published>
        <updated>2021-04-17T17:32:34+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/ssh-comment/"/>
        <id>https://nbari.com/ssh-comment/</id>
        
        <content type="html" xml:base="https://nbari.com/ssh-comment/">&lt;p&gt;Create a new pair of ssh keys RSA with a custom comment:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ssh-keygen -C &amp;quot;monkey&amp;quot; -t rsa -b 4096 -o -a 100 -f /tmp/monkey&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>fdesetup</title>
        <published>2021-04-15T17:09:06+02:00</published>
        <updated>2021-04-15T17:09:06+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/fdesetup/"/>
        <id>https://nbari.com/fdesetup/</id>
        
        <content type="html" xml:base="https://nbari.com/fdesetup/">&lt;p&gt;To remove a user from the login screen when booting and login from the first time:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sudo fdesetup remove -user monkey&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The user will not be listed any more in the login screen, but you will need
first logging with a user that can decrypt the disk and then switch to your
user.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Note this will not delete or remove the user account&lt;/p&gt;
&lt;/blockquote&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>ssh only password</title>
        <published>2021-04-14T17:03:59+02:00</published>
        <updated>2021-04-14T17:03:59+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/ssh-only-password/"/>
        <id>https://nbari.com/ssh-only-password/</id>
        
        <content type="html" xml:base="https://nbari.com/ssh-only-password/">&lt;p&gt;When using &lt;code&gt;ssh&lt;/code&gt; if you only need to use password (no keys):&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ssh -o PreferredAuthentications=password -o PubkeyAuthentication=no &amp;lt;host&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>yumdownloader</title>
        <published>2021-04-07T16:30:51+02:00</published>
        <updated>2021-04-07T16:30:51+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/yumdownloader/"/>
        <id>https://nbari.com/yumdownloader/</id>
        
        <content type="html" xml:base="https://nbari.com/yumdownloader/">&lt;p&gt;To download &lt;code&gt;rpms&lt;/code&gt; for using them in an offline environment, install first &lt;code&gt;yumdownloader&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;yum install yum-utils&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Create a directory to store the &lt;code&gt;rpm&#39;s&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mkdir /tmp/rpms&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Download the rpms:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;yumdownloader --destdir=/tmp/rpms --resolve MariaDB-server galera-4 MariaDB-client MariaDB-shared MariaDB-backup MariaDB-common&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>psql</title>
        <published>2021-03-06T17:04:38+01:00</published>
        <updated>2021-03-06T17:04:38+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/psql/"/>
        <id>https://nbari.com/psql/</id>
        
        <content type="html" xml:base="https://nbari.com/psql/">&lt;p&gt;To install &lt;code&gt;PostgreSQL&lt;/code&gt; client on macOS:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;brew doctor&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;brew update&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;brew install libpq&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Test:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ psql -V&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;psql (PostgreSQL) 13.2&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Flush DNS</title>
        <published>2021-01-29T20:34:44+01:00</published>
        <updated>2021-01-29T20:34:44+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/flush-dns/"/>
        <id>https://nbari.com/flush-dns/</id>
        
        <content type="html" xml:base="https://nbari.com/flush-dns/">&lt;p&gt;To flush DNS on macOS:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sudo killall -HUP mDNSResponder;sudo killall mDNSResponderHelper;sudo dscacheutil -flushcache&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Centos Disable Ipv6</title>
        <published>2020-11-29T13:38:41+01:00</published>
        <updated>2020-11-29T13:38:41+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/centos-disable-ipv6/"/>
        <id>https://nbari.com/centos-disable-ipv6/</id>
        
        <content type="html" xml:base="https://nbari.com/centos-disable-ipv6/">&lt;p&gt;Edit file &lt;code&gt;/etc/default/grub&lt;/code&gt; and add &lt;code&gt;ipv6.disable=1&lt;/code&gt;, example:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# cat /etc/default/grub&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;GRUB_TIMEOUT=5&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;GRUB_DEFAULT=saved&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;GRUB_DISABLE_SUBMENU=true&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;GRUB_TERMINAL_OUTPUT=&amp;quot;console&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;GRUB_CMDLINE_LINUX=&amp;quot;ipv6.disable=1 crashkernel=auto rhgb quiet&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;GRUB_DISABLE_RECOVERY=&amp;quot;true&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then regenerate and reboot:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;grub2-mkconfig -o /boot/grub2/grub.cfg&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;reboot&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Using sysctl (no need to reboot), append below lines in &lt;code&gt;/etc/sysctl.conf&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;net.ipv6.conf.all.disable_ipv6 = 1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;net.ipv6.conf.default.disable_ipv6 = 1&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then run:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sysctl -p&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>storj</title>
        <published>2020-10-18T18:59:32+02:00</published>
        <updated>2020-10-18T18:59:32+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/storj/"/>
        <id>https://nbari.com/storj/</id>
        
        <content type="html" xml:base="https://nbari.com/storj/">&lt;p&gt;Setup up and configure your jail, then create user &lt;code&gt;storj&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pw useradd -n storj -m&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Clone and get and install latest version:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;git clone -b v1.14.7 https://github.com/storj/storj.git storj&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cd storj&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;go install -race -v storj.io/storj/cmd/...&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Create a dir to contanin the identity and storage:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mkdir /mnt/storj&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;chown -R storj:storj /mnt/storj&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In the main host create the file system to be used in the jail:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;zfs create tank/storj&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Create &lt;code&gt;fstat.storj&lt;/code&gt; with something like:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;/tank/storj     /jails/storj/mnt/storj    nullfs  rw      0       0&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;mkdir /jails/storej/mnt/storj&lt;/code&gt; before starting the jail&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Change to user &lt;code&gt;storj&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;su - storj&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Setup the node:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;/home/storj/go/bin/storagenode setup --config-dir /mnt/storj --identity-dir /mnt/storj/identity&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Config lools somethinig like:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;contact.external-address: &amp;quot;IP or FQDN:28967&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;identity.cert-path: /mnt/storj/identity/identity.cert&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;identity.key-path: /mnt/storj/identity/identity.key&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;log.level: info&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;operator.email: &amp;quot;your email address&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;operator.wallet: &amp;quot;your wallet address&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;server.address: :28967&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;server.private-address: 127.0.0.1:7778&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;server.revocation-dburl: bolt:///mnt/storj/storage/revocations.db&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;storage.allocated-disk-space: 2.00 TB&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;storage.path: /mnt/storj/storage&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Create an identity:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;/home/storj/go/bin/identity --config-dir /mnt/storj/identity create storagenode&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;this will take hours&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Backup before you continue, it should be quick! 🙏
This allows you to restore your Node in case of an unfortunate hardware or OS incident.&lt;/p&gt;
&lt;p&gt;Authorize the identity:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;/home/storj/go/bin/identity authorize storagenode &amp;lt;email:characterstring&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;https://documentation.storj.io/dependencies/identity&lt;/p&gt;
&lt;p&gt;Startup using immortal:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pkg install immortal&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Create &lt;code&gt;/usr/local/etc/immortal/storj.yml&lt;/code&gt; with something like:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;cmd&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; /home/storj/go/bin/storagenode run --config-dir /mnt/storj/storage --identity-dir /mnt/storj/identity&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; storj&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;  file&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; /var/log/storj.log&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Enable &lt;code&gt;immortaldir_enable&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sysrc immortaldir_enable=&amp;quot;YES&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Start it:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;service immortaldir start&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Follow up: https://github.com/storj/storj/issues/3935&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>libx265</title>
        <published>2020-09-14T13:08:58+02:00</published>
        <updated>2020-09-14T13:08:58+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/libx265/"/>
        <id>https://nbari.com/libx265/</id>
        
        <content type="html" xml:base="https://nbari.com/libx265/">&lt;p&gt;To reduce/compress a video size you could use:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ffmpeg -i input.mov -vcodec libx265 -crf 28 output.mp4&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Be aware that &lt;code&gt;libx265&lt;/code&gt; is not supported in many players so you can always fallback to &lt;code&gt;H.264&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ffmpeg -i input.mov output.mp4&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;https://unix.stackexchange.com/questions/28803/how-can-i-reduce-a-videos-size-with-ffmpeg&lt;/p&gt;
&lt;/blockquote&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>favicon</title>
        <published>2020-07-28T19:19:05+02:00</published>
        <updated>2020-07-28T19:19:05+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/favicon/"/>
        <id>https://nbari.com/favicon/</id>
        
        <content type="html" xml:base="https://nbari.com/favicon/">&lt;p&gt;Create a favicon from a &lt;code&gt;.png&lt;/code&gt; using imagemagick &lt;code&gt;convert&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;convert favicon.png -define icon:auto-resize=64,48,32,16 favicon.ico&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Import large dump</title>
        <published>2020-06-12T21:59:02+02:00</published>
        <updated>2020-06-12T21:59:02+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/import-large-dump/"/>
        <id>https://nbari.com/import-large-dump/</id>
        
        <content type="html" xml:base="https://nbari.com/import-large-dump/">&lt;p&gt;To import a large dump (~300GB) you could do:&lt;/p&gt;
&lt;p&gt;Split your file first:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;csplit -s -ftable dump.sql &amp;quot;/-- Table structure for table/&amp;quot; {999}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You could also use the pattern &lt;code&gt;{*}&lt;/code&gt; but you need the &lt;code&gt;gcsplit&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pkg install coreutils&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;BSD csplit don&#39;t support &lt;code&gt;{*}&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Then try:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gcsplit -s -ftable dump.sql &amp;quot;/-- Table structure for table/&amp;quot; {*}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Create small &lt;code&gt;INSERT&lt;/code&gt; chunks:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gsplit -a 3 -d -n l/200 table05 x_&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;l/N&lt;/code&gt;  split into N files without splitting lines/records&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Set bulk_insert_buffer_size to 1GB:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mysql&amp;gt; SET bulk_insert_buffer_size = 1024 * 1024 * 1024;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Or in the &lt;code&gt;my.cnf&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[mysqld]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;bulk_insert_buffer_size = 1G&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;needs a restart&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Set network buffer and maximum allowed packet size length to a large byte number.&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mysql&amp;gt; SET GLOBAL net_buffer_length=1000000;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mysql&amp;gt; SET GLOBAL max_allowed_packet=1000000000;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mysql&amp;gt; SET foreign_key_checks = 0;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mysql&amp;gt; SET unique_checks = 0;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mysql&amp;gt; SET autocommit = 0;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Import the file:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mysql&amp;gt; source file.sql&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Ugly way to prevent mysql consuming all memory:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;for t in x_*&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(echo $t; mysql db_name &amp;lt; $t &amp;amp;&amp;amp; service mysql-server restart &amp;amp;&amp;amp; sleep 2)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Set back the checks:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mysql&amp;gt; SET foreign_key_checks = 1;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mysql&amp;gt; SET unique_checks = 1;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mysql&amp;gt; SET autocommit = 1;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Delete in chunks</title>
        <published>2020-06-12T14:12:56+02:00</published>
        <updated>2020-06-12T14:12:56+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/delete-in-chunks/"/>
        <id>https://nbari.com/delete-in-chunks/</id>
        
        <content type="html" xml:base="https://nbari.com/delete-in-chunks/">&lt;p&gt;To delete a big/huge table in chunks, you could create this store procedure,
but the performance at the end depends of how good/normalized is your database
(indexes):&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;A stored procedure is a prepared SQL code that you can save, so the code can
be reused over and over again. Such procedures are stored in the database data
dictionary.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Connect to the database and select the database:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mysql&amp;gt; \u my_database&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Database changed&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To list stored procedures&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mysql&amp;gt; SHOW PROCEDURE STATUS;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Create the delete procedure:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mysql&amp;gt; DROP PROCEDURE IF EXISTS archive_table;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;This will delete any existing procedures named &lt;code&gt;archive_table&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Change the delimiter:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mysql&amp;gt; DELIMITER $$&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;When you write SQL statements, you use the semicolon (;) to separate two statements. A stored procedure, however, consists of multiple statements separated by a semicolon (;).If you use a MySQL client program to define a stored procedure that contains semicolon characters, the MySQL client program will not treat the whole stored procedure as a single statement, but many statements. Therefore, you must redefine the delimiter temporarily so that you can pass the whole stored procedure to the server as a single statement.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Create the procedure:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;sql&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-10&quot;&gt;CREATE PROCEDURE&lt;/span&gt;&lt;span&gt; archive_table&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;()&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-10&quot;&gt;BEGIN&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-10&quot;&gt;    REPEAT&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-10&quot;&gt;        DELETE FROM&lt;/span&gt;&lt;span&gt; table_name&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-10&quot;&gt;        WHERE&lt;/span&gt;&lt;span&gt; time_stamp &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span&gt; unix_timestamp(&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;NOW&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;() -&lt;/span&gt;&lt;span&gt; INTERVAL &lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;2 MONTH&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-10&quot;&gt;        ORDER BY&lt;/span&gt;&lt;span&gt; time_stamp &lt;/span&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;-- time_stamp needs an INDEX&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-10&quot;&gt;        LIMIT 1000&lt;/span&gt;&lt;span&gt;; &lt;/span&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;-- can be tweaked&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-10&quot;&gt;        SELECT&lt;/span&gt;&lt;span&gt; SLEEP(&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;1&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    UNTIL ROW_COUNT&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;() =&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 0 END REPEAT&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-10&quot;&gt;END&lt;/span&gt;&lt;span&gt;$$&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;For &lt;code&gt;MyISAM&lt;/code&gt; you could try &lt;code&gt;DELETE LOW_PRIORITY QUICK FROM table_name&lt;/code&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;LIMIT leads to a warning on replication about it being non-deterministic, see more here: http://mysql.rjweb.org/doc.php/deletebig&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Set back the delimiter to &lt;code&gt;;&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mysql&amp;gt; DELIMITER ;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And that&#39;s it, to call the store procedure and start deleting records use:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mysql&amp;gt; CALL archive_table();&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Bypass AllowTcpForwarding</title>
        <published>2020-05-11T13:43:01+02:00</published>
        <updated>2020-05-11T13:43:01+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/bypass-allowtcpforwarding/"/>
        <id>https://nbari.com/bypass-allowtcpforwarding/</id>
        
        <content type="html" xml:base="https://nbari.com/bypass-allowtcpforwarding/">&lt;p&gt;To bypass &lt;code&gt;AllowTcpForwarding no&lt;/code&gt; try using &lt;code&gt;socat&lt;/code&gt; and &lt;code&gt;nc&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;socat TCP-LISTEN:&amp;lt;local port&amp;gt;,reuseaddr,fork &amp;quot;EXEC:ssh &amp;lt;server&amp;gt; nc localhost &amp;lt;remote port&amp;gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;For example from your desktop run:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;socat TCP-LISTEN:8080,reuseaddr,fork &amp;quot;EXEC:ssh 1.2.3.4 nc 10.0.0.1 3000&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This will listen on local port &lt;code&gt;8080&lt;/code&gt; connect via ssh to &lt;code&gt;1.2.3.4&lt;/code&gt; and use &lt;code&gt;nc&lt;/code&gt;
to connect &lt;code&gt;10.0.1.1:3000&lt;/code&gt;&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>rust strip</title>
        <published>2020-05-08T21:46:13+02:00</published>
        <updated>2020-05-08T21:46:13+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/rust-strip/"/>
        <id>https://nbari.com/rust-strip/</id>
        
        <content type="html" xml:base="https://nbari.com/rust-strip/">&lt;p&gt;To build &amp;amp;&amp;amp; strip a binary use:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;RUSTFLAGS=&amp;#39;-C link-arg=-s&amp;#39; cargo build --release&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;strip&lt;/code&gt;  removes or modifies the symbol table attached to the output of the assembler and link editor.
This is useful to save space after a program has been debugged and to limit dynamically bound symbols.&lt;/p&gt;
&lt;/blockquote&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>sed append</title>
        <published>2020-03-29T18:29:39+02:00</published>
        <updated>2020-03-29T18:29:39+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/sed-append/"/>
        <id>https://nbari.com/sed-append/</id>
        
        <content type="html" xml:base="https://nbari.com/sed-append/">&lt;p&gt;To append a line using &lt;code&gt;sed&lt;/code&gt; that works on macOS:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sed -e &amp;#39;/^telegraf_enab.*/a\&amp;#39;$&amp;#39;\n&amp;#39;&amp;#39;telegraf_user=&amp;quot;root&amp;quot;&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If need to do it in multiple files, you could use &lt;code&gt;find&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; find . -name &amp;quot;rc.conf&amp;quot; -exec sed -i &amp;#39;&amp;#39; -e &amp;#39;/^telegraf_enab.*/a\&amp;#39;$&amp;#39;\n&amp;#39;&amp;#39;telegraf_user=&amp;quot;root&amp;quot;&amp;#39; {} \;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;https://stackoverflow.com/a/48406504/1135424&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Fat16</title>
        <published>2020-03-23T16:26:45+01:00</published>
        <updated>2020-03-23T16:26:45+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/fat16/"/>
        <id>https://nbari.com/fat16/</id>
        
        <content type="html" xml:base="https://nbari.com/fat16/">&lt;p&gt;When trying to update a bios from an USB pen, probably you will need FAT16 or FAT32, to do this from macOS try:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;diskutil partitiondisk /dev/disk3 1 MBR &amp;quot;MS-DOS FAT16&amp;quot; &amp;quot;NONAME&amp;quot; 0B&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;/dev/disk3 - disk device to be partitioned, found with &#39;diskutil list&#39;&lt;/li&gt;
&lt;li&gt;1 - number of partitions, optional, but if given must match&lt;/li&gt;
&lt;li&gt;MBR - partition Scheme (eg, DOS=MBR, Mac=GPT)&lt;/li&gt;
&lt;li&gt;MS-DOS FAT16 - partition type (or fat32) *&lt;/li&gt;
&lt;li&gt;NONAME - partition name&lt;/li&gt;
&lt;li&gt;0B - partition size (0B=maximum)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Then:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sudo newfs_msdos -F 16 /dev/disk3s1&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;See more: https://pbxbook.com/other/dosfat16.html&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>VLC keep resized window size</title>
        <published>2020-03-08T13:06:31+01:00</published>
        <updated>2020-03-08T13:06:31+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/vlc-keep-resized-window-size/"/>
        <id>https://nbari.com/vlc-keep-resized-window-size/</id>
        
        <content type="html" xml:base="https://nbari.com/vlc-keep-resized-window-size/">&lt;p&gt;To prevent VLC from resizing the window every time you open a new video:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;VLC -&amp;gt; Preferences -&amp;gt; Show All -&amp;gt; Interface/Main interface/macosx&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Uncheck the option &lt;code&gt;Resize interface to the native video size&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/img/vlc-preferences1.png&quot; alt=&quot;vlc&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/img/vlc-preferences2.png&quot; alt=&quot;vlc&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>get the Primary IP</title>
        <published>2020-02-26T14:33:47+01:00</published>
        <updated>2020-02-26T14:33:47+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/get-primary-ip/"/>
        <id>https://nbari.com/get-primary-ip/</id>
        
        <content type="html" xml:base="https://nbari.com/get-primary-ip/">&lt;p&gt;To get the primary IP in Linux:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ip route get 1 | awk &amp;#39;{print $NF;exit}&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;In &lt;code&gt;awk&lt;/code&gt; NF return the number of fields and by suffixing it with &lt;code&gt;$&lt;/code&gt; is like doing &lt;code&gt;print $7&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;In macOS, to list all your interfaces:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;networksetup -listallhardwareports&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If want to get the IP assigned to the Wi-FI:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ipconfig getifaddr $(networksetup -listallhardwareports | awk &amp;#39;/Hardware Port: Wi-Fi/{getline; print $2}&amp;#39;)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>redis over TLS</title>
        <published>2020-02-23T14:48:39+01:00</published>
        <updated>2020-02-23T14:48:39+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/redis-over-tls/"/>
        <id>https://nbari.com/redis-over-tls/</id>
        
        <content type="html" xml:base="https://nbari.com/redis-over-tls/">&lt;p&gt;Using &lt;code&gt;socat&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;brew install socat&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Create the tunnel:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;socat -v TCP-LISTEN:6379,fork,reuseaddr ssl:your.redis.example.com:6379&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Use &lt;code&gt;redis-cli&lt;/code&gt; as usual&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>removing the ^M character</title>
        <published>2020-02-07T19:47:46+01:00</published>
        <updated>2020-02-07T19:47:46+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/m-character-windows/"/>
        <id>https://nbari.com/m-character-windows/</id>
        
        <content type="html" xml:base="https://nbari.com/m-character-windows/">&lt;p&gt;In vim, to remove the &lt;code&gt;^M&lt;/code&gt; character you could do:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;:e ++ff=dos&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The &lt;code&gt;:e ++ff=dos&lt;/code&gt; command tells Vim to read the file again, forcing dos file
format. Vim will remove CRLF and LF-only line endings, leaving only the text of
each line in the buffer.&lt;/p&gt;
&lt;p&gt;Then set filetype to unix:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;:set ff=unix&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And save the file:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;:x&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Python quit unexpectedly macOS Catalina</title>
        <published>2020-01-20T17:21:40+01:00</published>
        <updated>2020-01-20T17:21:40+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/python-quit-unexpectedly-macos/"/>
        <id>https://nbari.com/python-quit-unexpectedly-macos/</id>
        
        <content type="html" xml:base="https://nbari.com/python-quit-unexpectedly-macos/">&lt;p&gt;When running something depending on OpenSSL you may get something like this on
&lt;code&gt;macOS 10.15.2&lt;/code&gt;:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/img/python_quit_1.png&quot; alt=&quot;python quit unexpectedly&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;&lt;/p&gt;
&lt;p&gt;The output of the report:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/img/python_quit_2.png&quot; alt=&quot;python quit unexpectedly report&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;&lt;/p&gt;
&lt;p&gt;To fix:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;brew reinstall openssl&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cd /usr/local/lib&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sudo ln -s /usr/local/opt/openssl/lib/libssl.dylib libssl.dylib&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sudo ln -s /usr/local/opt/openssl/lib/libcrypto.dylib libcrypto.dylib&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>postfix version</title>
        <published>2019-11-23T17:19:02+01:00</published>
        <updated>2019-11-23T17:19:02+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/postfix-version/"/>
        <id>https://nbari.com/postfix-version/</id>
        
        <content type="html" xml:base="https://nbari.com/postfix-version/">&lt;p&gt;In &lt;code&gt;Postfix&lt;/code&gt; there is no &lt;code&gt;-v&lt;/code&gt; or &lt;code&gt;--vesion&lt;/code&gt;, to find the version run:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ postconf mail_version&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>macOs catalina &amp; python</title>
        <published>2019-11-12T16:20:28+01:00</published>
        <updated>2019-11-12T16:20:28+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/catalina-python/"/>
        <id>https://nbari.com/catalina-python/</id>
        
        <content type="html" xml:base="https://nbari.com/catalina-python/">&lt;p&gt;Reinstall openssl:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;brew reinstall openssl&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And then:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;export DYLD_LIBRARY_PATH=/usr/local/opt/openssl/lib:$DYLD_LIBRARY_PATH&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Or create the link manually:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cd /usr/local/lib&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sudo ln -s /usr/local/opt/openssl/lib/libssl.dylib libssl.dylib&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sudo ln -s /usr/local/opt/openssl/lib/libcrypto.dylib libcrypto.dylib&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Reinstall python:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;brew reinstall python&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Upgrade pip packages:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pip install -U --user $(pip freeze | awk -F&amp;#39;[=]&amp;#39; &amp;#39;{print $1}&amp;#39;)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Resume Tar</title>
        <published>2019-09-26T18:26:24+02:00</published>
        <updated>2019-09-26T18:26:24+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/resume-tar/"/>
        <id>https://nbari.com/resume-tar/</id>
        
        <content type="html" xml:base="https://nbari.com/resume-tar/">&lt;p&gt;To resume a terminated pr If while extracting a file, the process gets
terminated you may be available to resume it with:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    tar -xvkf file.tgz&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;-k (x mode only) Do not overwrite existing files. In particular, if a file
appears more than once in an archive, later copies will not overwrite earlier
copies.&lt;/p&gt;
&lt;/blockquote&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>convert svg</title>
        <published>2019-09-15T17:50:26+02:00</published>
        <updated>2019-09-15T17:50:26+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/convert-svg/"/>
        <id>https://nbari.com/convert-svg/</id>
        
        <content type="html" xml:base="https://nbari.com/convert-svg/">&lt;p&gt;Convert &lt;code&gt;svg&lt;/code&gt; to &lt;code&gt;png&lt;/code&gt; having transparent background:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ convert -background none -density 1200 in.svg out.png&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;brew install imagemagick librsvg&lt;/p&gt;
&lt;/blockquote&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>extent</title>
        <published>2019-09-15T10:23:40+02:00</published>
        <updated>2019-09-15T10:23:40+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/extent/"/>
        <id>https://nbari.com/extent/</id>
        
        <content type="html" xml:base="https://nbari.com/extent/">&lt;p&gt;To resize an image and adjust it to fit a fixed canvas with transparent
background:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ convert in.png \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-resize 128x128 \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-background none \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-gravity center \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-extent 128x128 \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;out.png&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>mysql CRC32</title>
        <published>2019-09-08T11:04:38+02:00</published>
        <updated>2019-09-08T11:04:38+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/mysql-crc32/"/>
        <id>https://nbari.com/mysql-crc32/</id>
        
        <content type="html" xml:base="https://nbari.com/mysql-crc32/">&lt;p&gt;If need to calculate the
&lt;a rel=&quot;external&quot; href=&quot;https://en.wikipedia.org/wiki/Cyclic_redundancy_check&quot;&gt;&lt;code&gt;CRC32&lt;/code&gt;&lt;/a&gt; of a string,
using mysql:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ mysql -e &amp;quot;SELECT CRC32(&amp;#39;127.0.0.1&amp;#39;)&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+--------------------+&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;| CRC32(&amp;#39;127.0.0.1&amp;#39;) |&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+--------------------+&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|         3619153832 |&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+--------------------+&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>grep -H</title>
        <published>2019-09-07T18:41:37+02:00</published>
        <updated>2019-09-07T18:41:37+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/grep-h/"/>
        <id>https://nbari.com/grep-h/</id>
        
        <content type="html" xml:base="https://nbari.com/grep-h/">&lt;p&gt;To find path of a file containing a pattern:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ cd jails&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ grep -H 34 */etc/ssh/sshd_config&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In this example the path of the files containing the number &lt;code&gt;34&lt;/code&gt; will be
printed.&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>online.net IPv6</title>
        <published>2019-09-03T20:18:00+02:00</published>
        <updated>2019-09-03T20:18:00+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/online-net-ipv6/"/>
        <id>https://nbari.com/online-net-ipv6/</id>
        
        <content type="html" xml:base="https://nbari.com/online-net-ipv6/">&lt;p&gt;Configure IPv6 using &lt;code&gt;dhcp6c&lt;/code&gt; for servers from online.net:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pkg install dhcp6&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Transform the DUID into a binary file (needed for dhcp6c):&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;echo &amp;lt;DUID&amp;gt; | awk &amp;#39;{ gsub(&amp;quot;:&amp;quot;,&amp;quot; &amp;quot;); printf &amp;quot;0: 0a 00 %s\n&amp;quot;, $0 }&amp;#39; | xxd -r &amp;gt; /var/db/dhcp6c_duid&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Add this in &lt;code&gt;/usr/local/etc/dhcp6c.conf&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;id-assoc pd {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        prefix-interface igb0 {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        };&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;};&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;id-assoc na {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;};&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;interface igb0 {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    send ia-pd 0;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    send ia-na 0;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;};&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Add this to &lt;code&gt;/etc/rc.conf&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ifconfig_igb0_ipv6=&amp;quot;inet6 -ifdisabled accept_rtadv up&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dhcp6c_enable=&amp;quot;YES&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dhcp6c_interfaces=&amp;quot;igb0&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;rtsold_enable=&amp;quot;YES&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;source: https://angristan.xyz/configure-ipv6-freebsd-online-net-dedibox/&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Start 2 XS SATA</title>
        <published>2019-09-03T09:04:14+02:00</published>
        <updated>2019-09-03T09:04:14+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/start-2-xs-sata/"/>
        <id>https://nbari.com/start-2-xs-sata/</id>
        
        <content type="html" xml:base="https://nbari.com/start-2-xs-sata/">&lt;p&gt;To install FreeBSD using the rescue system on a &lt;code&gt;Start-2-XS-SATA&lt;/code&gt; from online.net:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;#!/bin/sh -x&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;USER&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;monkey&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PASSWORD&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;secret&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;gpart&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; destroy -F ada0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;gpart&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; create -s gpt ada0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;gpart&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; bootcode -b /boot/pmbr -p /boot/gptboot -i&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 1&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; ada0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;gpart&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; add -t freebsd-boot -l boot -s 128K ada0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;gpart&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; add -t freebsd-swap -l swap -s 4g ada0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;gpart&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; add -t freebsd-ufs -l root ada0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;gpart&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; set -a active ada0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;newfs&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; /dev/gpt/root&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;mount&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; /dev/gpt/root /mnt&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;cd&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; /tmp&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;fetch&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; http://ftp.fr.freebsd.org/pub/FreeBSD/releases/amd64/12.0-RELEASE/base.txz&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;fetch&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; http://ftp.fr.freebsd.org/pub/FreeBSD/releases/amd64/12.0-RELEASE/kernel.txz&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;cd&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; /mnt&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;tar&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; xJf /tmp/base.txz&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;tar&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; xJf /tmp/kernel.txz&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;rm&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; /tmp/&lt;/span&gt;&lt;span&gt;*&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;.txz&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;cat&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;lt;&amp;lt; EOF &amp;gt;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; /mnt/etc/fstab&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;/dev/gpt/root / ufs rw,noatime 1 1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;/dev/gpt/swap none swap sw 0 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;EOF&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;cat&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;lt;&amp;lt; EOF &amp;gt;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; /mnt/etc/rc.conf&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;ifconfig_igb0=&amp;quot;DHCP&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;sshd_enable=&amp;quot;YES&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;EOF&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;cat&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;lt;&amp;lt; EOF &amp;gt;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; /mnt/boot/loader.conf&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;boot_multicons=&amp;quot;YES&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;boot_serial=&amp;quot;YES&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;comconsole_speed=&amp;quot;9600&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;console=&amp;quot;comconsole&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;comconsole_port=&amp;quot;0x2F8&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;EOF&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;cat&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;lt;&amp;lt; EOF &amp;gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; /mnt/etc/ttys&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;ttyu1   &amp;quot;/usr/libexec/getty std.9600&amp;quot;   vt100   on  secure&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;EOF&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;chroot&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; /mnt pw useradd&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; ${&lt;/span&gt;&lt;span&gt;USER&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -m -G wheel -s /bin/csh -h&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 0&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;lt;&amp;lt;EOP&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;${&lt;/span&gt;&lt;span&gt;PASSWORD&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;EOP&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;echo&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;terminated&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Prevent Mac to Sleep</title>
        <published>2019-08-28T21:20:50+02:00</published>
        <updated>2019-08-28T21:20:50+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/prevent-mac-to-sleep/"/>
        <id>https://nbari.com/prevent-mac-to-sleep/</id>
        
        <content type="html" xml:base="https://nbari.com/prevent-mac-to-sleep/">&lt;p&gt;To stop sleep entirely:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sudo pmset -a disablesleep 1&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To revert, allow sleep again:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sudo pmset -a disablesleep 0&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To display global power settings:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pmset -g&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>sudo SSH_CONNECTION</title>
        <published>2019-07-17T13:31:32+02:00</published>
        <updated>2019-07-17T13:31:32+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/sudo-ssh-connection/"/>
        <id>https://nbari.com/sudo-ssh-connection/</id>
        
        <content type="html" xml:base="https://nbari.com/sudo-ssh-connection/">&lt;p&gt;When using ssh, if then doing something like &lt;code&gt;sudo -i&lt;/code&gt; the environment vars
are gone, to preserve modify your &lt;code&gt;sudoers&lt;/code&gt; (&lt;code&gt;/usr/local/etc/sudoers&lt;/code&gt; or
&lt;code&gt;/usr/local/etc/sudoers.d/devops&lt;/code&gt;) and add something like:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Defaults env_keep += &amp;quot;SSH_TTY SSH_CONNECTION SSH_CLIENT&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In this case, it will preserve your SSH environment vars.&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>vbox headless</title>
        <published>2019-07-17T10:38:52+02:00</published>
        <updated>2019-07-17T10:38:52+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/vbox-headless/"/>
        <id>https://nbari.com/vbox-headless/</id>
        
        <content type="html" xml:base="https://nbari.com/vbox-headless/">&lt;p&gt;To list your vms:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ VBoxManage list vms&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To run one in &lt;code&gt;headless&lt;/code&gt; mode:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ VBoxManage startvm freebsd-server --type headless&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To shutdown:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ VBoxManage controlvm freebsd-server acpipowerbutton&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To get the IPv4:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ VBoxManage guestproperty enumerate freebsd-server | awk &amp;#39;/IP/&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;for this to work you will need the vboxguest tools &lt;code&gt;pkg install virtualbox-ose-additions&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>ddcctl</title>
        <published>2019-07-04T18:07:05+02:00</published>
        <updated>2019-07-04T18:07:05+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/ddcctl/"/>
        <id>https://nbari.com/ddcctl/</id>
        
        <content type="html" xml:base="https://nbari.com/ddcctl/">&lt;p&gt;To share one monitor, keyboard and mouse between two devices, mac mini and a
macbook try:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;brew cask install barrier&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then to avoid changing the input source by using the buttons in the monitor try
https://github.com/kfix/ddcctl:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cd /tmp&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;git clone https://github.com/kfix/ddcctl.git&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cd ddcctl&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;make &amp;amp;&amp;amp; make install&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In my case to switch from the mac mini (HDMI) to the laptop via (DP) I use:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ddcctl -d 1 -i 15&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;From the laptop (USB-C -&amp;gt; DP) to HDMI, switch back to the mac mini:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ddcctl -d 1 -i 17&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>timestamp</title>
        <published>2019-06-03T21:47:58+02:00</published>
        <updated>2019-06-03T21:47:58+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/timestamp/"/>
        <id>https://nbari.com/timestamp/</id>
        
        <content type="html" xml:base="https://nbari.com/timestamp/">&lt;p&gt;To get the current unix timestamp:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;date +%s&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To get the date from a timestamp:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;date -r 1559591041&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In Linux:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;date -d &amp;quot;@1559591041&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>docker prune</title>
        <published>2019-05-29T00:41:33+02:00</published>
        <updated>2019-05-29T00:41:33+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/docker-prune/"/>
        <id>https://nbari.com/docker-prune/</id>
        
        <content type="html" xml:base="https://nbari.com/docker-prune/">&lt;p&gt;Docker cleanup:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; docker system prune -a&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>rust docker</title>
        <published>2019-05-28T22:16:35+02:00</published>
        <updated>2019-05-28T22:16:35+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/rust-docker/"/>
        <id>https://nbari.com/rust-docker/</id>
        
        <content type="html" xml:base="https://nbari.com/rust-docker/">&lt;p&gt;&lt;code&gt;Dockerfile&lt;/code&gt; to create small &lt;a rel=&quot;external&quot; href=&quot;https://rustlang.org&quot;&gt;rust&lt;/a&gt; docker images:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;FROM clux/muslrust&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;RUN mkdir /source&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;WORKDIR /source&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;COPY . .&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;RUN cargo build --release&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;RUN strip ./target/x86_64-unknown-linux-musl/release/myapp&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;FROM scratch&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;COPY --from=0 /source/target/x86_64-unknown-linux-musl/release/myapp /&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;CMD [&amp;quot;./myapp&amp;quot;]&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Image compatible with cloud foundry:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;FROM rust:1.35&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;WORKDIR /usr/src/myapp&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;COPY . .&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;RUN cargo build --release&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;FROM debian:latest&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;RUN apt-get update &amp;amp;&amp;amp; DEBIAN_FRONTEND=noninteractive apt-get install -y openssl ca-certificates&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;COPY --from=0 /usr/src/myapp/target/release/myapp /&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;CMD [&amp;quot;./myapp&amp;quot;]&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>mysql pager</title>
        <published>2019-05-15T10:35:50+02:00</published>
        <updated>2019-05-15T10:35:50+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/mysql-pager/"/>
        <id>https://nbari.com/mysql-pager/</id>
        
        <content type="html" xml:base="https://nbari.com/mysql-pager/">&lt;p&gt;To use &lt;code&gt;less&lt;/code&gt; command to vie the output of a mysql result you could use:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mysql&amp;gt; \P less&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;or&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mysql&amp;gt; pager less&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then run something like:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mysql&amp;gt; show engine innodb status\G&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In some cases you may need to search for something in specific for this &lt;code&gt;grep&lt;/code&gt;
could be used, for example:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mysql&amp;gt; \P grep -A7 &amp;quot;ROW OPERATIONS&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PAGER set to &amp;#39;grep -A7 &amp;quot;ROW OPERATIONS&amp;quot;&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then when running the command it will only return 7 lines after &quot;ROW OPERATIONS&quot;&lt;/p&gt;
&lt;h2 id=&quot;disable&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#disable&quot; aria-label=&quot;Anchor link for: disable&quot;&gt;🔗&lt;/a&gt;disable&lt;/h2&gt;
&lt;p&gt;To disable the pager type &lt;code&gt;\n&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mysql&amp;gt; \n&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Pager disabled.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Time: 0.000s&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>//+build disable</title>
        <published>2019-05-14T19:10:27+02:00</published>
        <updated>2019-05-14T19:10:27+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/build-disable/"/>
        <id>https://nbari.com/build-disable/</id>
        
        <content type="html" xml:base="https://nbari.com/build-disable/">&lt;p&gt;In &lt;a rel=&quot;external&quot; href=&quot;https://golang.org&quot;&gt;go&lt;/a&gt; if need to sketch something and end having &lt;code&gt;func main()&lt;/code&gt; in two files, you could ignore building one by adding at the top of the
file:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;// +build disable&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This is a &lt;a rel=&quot;external&quot; href=&quot;https://golang.org/pkg/go/build/#hdr-Build_Constraints&quot;&gt;build constraint&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;A build constraint, also known as a build tag, is a line comment that begins:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;// +build&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>delete file</title>
        <published>2019-05-06T14:44:58+02:00</published>
        <updated>2019-05-06T14:44:58+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/delete-file/"/>
        <id>https://nbari.com/delete-file/</id>
        
        <content type="html" xml:base="https://nbari.com/delete-file/">&lt;p&gt;Ways to delete a file starting with a dash / hyphen:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;rm -- -file&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The option &lt;code&gt;--&lt;/code&gt;  means the end of options for the command.&lt;/p&gt;
&lt;p&gt;Another option is to indicate where is the file:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;rm ./-file&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;.&lt;/code&gt; is current directory , path to &lt;code&gt;-file&lt;/code&gt; is &lt;code&gt;./-file&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Using find:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;find . -type f -exec rm {} \;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Finding the inode:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ls -li&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then using &lt;code&gt;find&lt;/code&gt; and the inode it can be removed with:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;find . -type f -inum &amp;lt;inum&amp;gt; -delete&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>galera SOS</title>
        <published>2019-04-10T19:29:55+02:00</published>
        <updated>2019-04-10T19:29:55+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/galera-sos/"/>
        <id>https://nbari.com/galera-sos/</id>
        
        <content type="html" xml:base="https://nbari.com/galera-sos/">&lt;p&gt;Check status of cluster: https://nbari.com/post/galera/&lt;/p&gt;
&lt;p&gt;Find process list not sleeping:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SELECT user, time, state, info FROM information_schema.processlist WHERE command != &amp;#39;Sleep&amp;#39; AND time &amp;gt;= 2 ORDER BY time DESC, id;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Doing a heavy &lt;code&gt;DDL&lt;/code&gt; (&lt;code&gt;ALTER&lt;/code&gt;):&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SELECT * FROM information_schema.processlist WHERE command != &amp;#39;Sleep&amp;#39; AND info LIKE &amp;#39;alter%&amp;#39; AND time &amp;gt;= 2 ORDER BY time DESC, id LIMIT 1;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;DDL stands for data definition language. It is a set of SQL statements that work on the database as a whole, rather than an individual table or row. Create, alter, and drop are elements of this language.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Get locked tables:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;show open tables where in_use &amp;gt; 0;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Finding locks:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;show engine innodb status;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;At the end:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---TRANSACTION 1135701157, ACTIVE 6768 sec&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;MySQL thread id 5208136, OS thread handle 0x7f2982e91700, query id 882213399 xxxIPxxx 82.235.36.49 my_user cleaning up&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;kill the transaction thread:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; KILL 5208136;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Information about all locks transactions are waiting for:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;select * from information_schema.innodb_lock_waits;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;A list of blocking transactions:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SELECT * FROM information_schema.INNODB_LOCKS WHERE LOCK_TRX_ID IN (SELECT BLOCKING_TRX_ID FROM INNODB_LOCK_WAITS);&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Or:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SELECT INNODB_LOCKS.* FROM information_schema.INNODB_LOCKS JOIN INNODB_LOCK_WAITS ON (INNODB_LOCKS.LOCK_TRX_ID = INNODB_LOCK_WAITS.BLOCKING_TRX_ID);&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;A list of transactions waiting for locks:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SELECT TRX_ID, TRX_REQUESTED_LOCK_ID, TRX_MYSQL_THREAD_ID, TRX_QUERY FROM information_schema.INNODB_TRX WHERE TRX_STATE = &amp;#39;LOCK WAIT&amp;#39;;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To check logs with &lt;code&gt;pt-query-digest&lt;/code&gt;, first get the binlog and do:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mysqlbinlog --start-datetime=&amp;quot;2019-04-10 10:40:00&amp;quot; --stop-datetime=&amp;quot;2019-04-10 11:00:00&amp;quot; mysql-bin.0013* &amp;gt; out.sql&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pt-query-digest --type binlog --group-by fingerprint --limit &amp;quot;100%&amp;quot; out.sql &amp;gt; report.txt&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;in macOS if getting a segmentation fault use the full path
&lt;code&gt;/usr/local/Cellar/percona-toolkit/3.0.13/libexec/bin/pt-query-digest&lt;/code&gt; or download
the lates version from https://www.percona.com/get/pt-query-digest&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Get all table sizes for specific database in MB:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SELECT&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    table_schema &amp;#39;Database Name&amp;#39;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    SUM(data_length + index_length) &amp;#39;Size in Bytes&amp;#39;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ROUND(SUM(data_length + index_length) / 1024 / 1024, 2) &amp;#39;Size in MiB&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;FROM information_schema.tables&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;GROUP BY table_schema&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ORDER BY 2 DESC limit 10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;For a specific database:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SELECT&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    table_schema &amp;#39;Database Name&amp;#39;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    SUM(data_length + index_length) &amp;#39;Size in Bytes&amp;#39;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ROUND(SUM(data_length + index_length) / 1024 / 1024, 2) &amp;#39;Size in MiB&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;FROM information_schema.tables&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;WHERE table_schema = &amp;#39;your_db_name&amp;#39;;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Get a specific table size for a database in MB:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SELECT table_name AS &amp;quot;Table&amp;quot;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ROUND(((data_length + index_length) / 1024 / 1024), 2) AS &amp;quot;Size (MB)&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;FROM information_schema.TABLES&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;WHERE table_schema = &amp;quot;database_name&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ORDER BY (data_length + index_length) DESC;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;How to calculate a good InnoDB log file size: (http://code.openark.org/blog/mysql/how-to-calculate-a-good-innodb-log-file-size-recap)&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SELECT&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  innodb_os_log_written_per_minute*60&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    AS estimated_innodb_os_log_written_per_hour,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  CONCAT(ROUND(innodb_os_log_written_per_minute*60/1024/1024, 1), &amp;#39;MB&amp;#39;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    AS estimated_innodb_os_log_written_per_hour_mb&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;FROM&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  (SELECT SUM(value) AS innodb_os_log_written_per_minute FROM (&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    SELECT -VARIABLE_VALUE AS value&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      FROM INFORMATION_SCHEMA.GLOBAL_STATUS&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      WHERE VARIABLE_NAME = &amp;#39;innodb_os_log_written&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    UNION ALL&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    SELECT SLEEP(60)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      FROM DUAL&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    UNION ALL&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    SELECT VARIABLE_VALUE&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      FROM INFORMATION_SCHEMA.GLOBAL_STATUS&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      WHERE VARIABLE_NAME = &amp;#39;innodb_os_log_written&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ) s1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;) s2;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Find if a &lt;code&gt;mysqldump&lt;/code&gt; is running:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SELECT * FROM information_schema.processlist WHERE info LIKE &amp;#39;SELECT /*!40001 SQL_NO_CACHE */%&amp;#39;;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Free some space in case &lt;code&gt;--log-bin&lt;/code&gt; is enabled:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PURGE BINARY LOGS BEFORE NOW();&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Or for an specific date:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PURGE BINARY LOGS BEFORE &amp;#39;20XX-01-01 00:00:00&amp;#39;;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>pigz</title>
        <published>2019-04-04T20:06:26+02:00</published>
        <updated>2019-04-04T20:06:26+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/pigz/"/>
        <id>https://nbari.com/pigz/</id>
        
        <content type="html" xml:base="https://nbari.com/pigz/">&lt;p&gt;To compress using gzip format but using all your available cores:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;tar --use-compress-program=pigz -cf archive.tgz /path/to/source&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Or if you want to pipe it:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;tar -cf - source | pigz &amp;gt; archive.tgz&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To decompress use &lt;code&gt;tar -xvf archive.tgz&lt;/code&gt; as usual.&lt;/p&gt;
&lt;p&gt;The output of &lt;a rel=&quot;external&quot; href=&quot;https://zlib.net/pigz/&quot;&gt;pigz&lt;/a&gt; is compatible with gzip&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>zsh</title>
        <published>2019-03-23T18:32:47+01:00</published>
        <updated>2019-03-23T18:32:47+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/zsh/"/>
        <id>https://nbari.com/zsh/</id>
        
        <content type="html" xml:base="https://nbari.com/zsh/">&lt;p&gt;Edit environment variables:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;vared PATH&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Diff command output creating temporary normal files&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;vimdiff =(ls /bin) =(ls /usr/bin)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Print path&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;print -l $path&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Run a command detached &lt;code&gt;&amp;amp;!&lt;/code&gt; or &lt;code&gt;&amp;amp;|&lt;/code&gt; put it in background and disown the process,
exiting the shell will leave it running:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sleep 300 &amp;amp;!&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Google Cloud Functions</title>
        <published>2019-03-13T20:12:57+01:00</published>
        <updated>2019-03-13T20:12:57+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/gcf/"/>
        <id>https://nbari.com/gcf/</id>
        
        <content type="html" xml:base="https://nbari.com/gcf/">&lt;p&gt;Testing &lt;a rel=&quot;external&quot; href=&quot;https://cloud.google.com/functions/&quot;&gt;Google Cloud Functions&lt;/a&gt; using &lt;a rel=&quot;external&quot; href=&quot;https://golang.org&quot;&gt;go&lt;/a&gt; with an average of 250 requests/second. Cost per day close to $10USD&lt;/p&gt;
&lt;p&gt;Request per day: 23,511,849
&lt;img src=&quot;/img/gcf-day-cost.png&quot; alt=&quot;cost&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Errors: 0
&lt;img src=&quot;/img/gcf-invocations.png&quot; alt=&quot;invocations&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;&lt;/p&gt;
&lt;p&gt;memory usage: 10.4MB
&lt;img src=&quot;/img/gcf-memory-usage.png&quot; alt=&quot;memory&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;&lt;/p&gt;
&lt;p&gt;execution time: 55.04ms
&lt;img src=&quot;/img/gcf-execution-time.png&quot; alt=&quot;execution_time&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/img/gcf-reports.png&quot; alt=&quot;reports&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>ssh wireshark</title>
        <published>2019-03-10T15:42:20+01:00</published>
        <updated>2019-03-10T15:42:20+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/ssh-wireshark/"/>
        <id>https://nbari.com/ssh-wireshark/</id>
        
        <content type="html" xml:base="https://nbari.com/ssh-wireshark/">&lt;p&gt;To analyze traffic remotely over ssh:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ssh use@server sudo tcpdump -U -s0 -i pflog0 -w -| wireshark -k -i -&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In case need an specific port:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ssh use@server sudo tcpdump -U -s0 -i pflog0 -w - &amp;#39;port 5984&amp;#39; | wireshark -k -i -&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To ignore trafic from ssh:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ssh use@server sudo tcpdump -U -s0 -i pflog0 -w - &amp;#39;not port 22&amp;#39; | wireshark -k -i -&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Or:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;wireshark -k -i &amp;lt;(ssh root@192.168.1.1 -p 2222 tcpdump -i em0 -U -w - not tcp port 22)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>ELK  delete_by_query</title>
        <published>2019-03-07T23:52:19+01:00</published>
        <updated>2019-03-07T23:52:19+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/elk-delte-by-query/"/>
        <id>https://nbari.com/elk-delte-by-query/</id>
        
        <content type="html" xml:base="https://nbari.com/elk-delte-by-query/">&lt;p&gt;To delete indexes older than X days:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;POST haproxy/_delete_by_query&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;	&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;query&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;: {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;		&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;: {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;			&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;ISODATE&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;: {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;				&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;lt&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;: &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;now-3d&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;			}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;		}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;	}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>openssl SHA1 HMAC</title>
        <published>2019-03-05T12:34:33+01:00</published>
        <updated>2019-03-05T12:34:33+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/openssl-sha1-hmac/"/>
        <id>https://nbari.com/openssl-sha1-hmac/</id>
        
        <content type="html" xml:base="https://nbari.com/openssl-sha1-hmac/">&lt;p&gt;To create an &lt;code&gt;HMAC-SHA1&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ echo -n &amp;quot;string&amp;quot; | openssl sha1 -hmac &amp;quot;shared_secret&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;or&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ echo -n &amp;quot;string&amp;quot; | openssl dgst -sha1 -hmac &amp;quot;shared_secret&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>DoH Firefox</title>
        <published>2019-02-15T15:26:10+01:00</published>
        <updated>2019-02-15T15:26:10+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/doh-firefox/"/>
        <id>https://nbari.com/doh-firefox/</id>
        
        <content type="html" xml:base="https://nbari.com/doh-firefox/">&lt;p&gt;Open firefox and type:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;about:config&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Search for:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;network.trr.uri&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Probably you already have:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;https://mozilla.cloudflare-dns.com/dns-query&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If not add it or use something like:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;https://cloudflare-dns.com/dns-query&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;https://dns.quad9.net/dns-query&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then enable &lt;code&gt;network.trr.mode&lt;/code&gt; by setting it to &lt;code&gt;2&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Set &lt;code&gt;network.trr.mode&lt;/code&gt; to 2 make DNS Over HTTPS the browser&#39;s first choice
but use regular DNS as a fallback (0 is &quot;off by default&quot;, 1 lets Firefox pick
whichever is faster, 3 for TRR only mode, 5 to explicitly turn it off).&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>osascript</title>
        <published>2019-02-08T08:55:41+01:00</published>
        <updated>2019-02-08T08:55:41+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/osascript/"/>
        <id>https://nbari.com/osascript/</id>
        
        <content type="html" xml:base="https://nbari.com/osascript/">&lt;p&gt;In macOS, to find a path of an application, for example &lt;code&gt;Chromium&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ osascript -e &amp;#39;POSIX path of (path to application &amp;quot;Chromium&amp;quot;)&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Galera</title>
        <published>2019-02-06T09:55:15+01:00</published>
        <updated>2019-02-06T09:55:15+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/galera/"/>
        <id>https://nbari.com/galera/</id>
        
        <content type="html" xml:base="https://nbari.com/galera/">&lt;p&gt;To periodically check status of the cluster, create a script (&lt;code&gt;/tmp/xx&lt;/code&gt;):&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;#!/bin/sh&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mysql -e \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;quot;SHOW GLOBAL STATUS WHERE Variable_name IN (&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;#39;wsrep_cert_deps_distance&amp;#39;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;#39;wsrep_cluster_size&amp;#39;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;#39;wsrep_cluster_status&amp;#39;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;#39;wsrep_connected&amp;#39;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;#39;wsrep_evs_delayed&amp;#39;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;#39;wsrep_flow_control_paused&amp;#39;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;#39;wsrep_flow_control_paused_ns&amp;#39;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;#39;wsrep_flow_control_recv&amp;#39;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;#39;wsrep_flow_control_sent&amp;#39;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;#39;wsrep_local_index&amp;#39;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;#39;wsrep_local_state&amp;#39;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;#39;wsrep_local_state_comment&amp;#39;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;#39;wsrep_ready&amp;#39;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;#39;wsrep_replicated&amp;#39;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;#39;wsrep_replicated_bytes&amp;#39;);&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;if credentials are in a custom path: &lt;code&gt;mysql --defaults-file=/path/to/.my.cnf -s -e&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;And run it with:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;watch sh /tmp/xx&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If single node alive (ERROR 1047 WSREP has not yet prepared node for application use):&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SET GLOBAL wsrep_provider_options=&amp;#39;pc.bootstrap=YES&amp;#39;;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This node can be used now has the new master so others nodes can recover from it.&lt;/p&gt;
&lt;p&gt;The below statement will give us an idea of the amount of data replicated by
Galera. Run the following statement on one of the Galera nodes during peak hours
(tested on MariaDB &amp;gt;10.0 and PXC &amp;gt;5.6, galera &amp;gt;3.x):&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SET @start := (SELECT SUM(VARIABLE_VALUE/1024/1024) FROM information_schema.global_status WHERE VARIABLE_NAME LIKE &amp;#39;WSREP%bytes&amp;#39;); do sleep(60); SET @end := (SELECT SUM(VARIABLE_VALUE/1024/1024) FROM information_schema.global_status WHERE VARIABLE_NAME LIKE &amp;#39;WSREP%bytes&amp;#39;); SET @gcache := (SELECT SUBSTRING_INDEX(SUBSTRING_INDEX(@@GLOBAL.wsrep_provider_options,&amp;#39;gcache.size = &amp;#39;,-1), &amp;#39;M&amp;#39;, 1)); SELECT ROUND((@end - @start),2) AS `MB/min`, ROUND((@end - @start),2) * 60 as `MB/hour`, @gcache as `gcache Size(MB)`, ROUND(@gcache/round((@end - @start),2),2) as `Time to full(minutes)`;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Will output something like:
+--------+---------+-----------------+-----------------------+
| MB/min | MB/hour | gcache Size(MB) | Time to full(minutes) |
+--------+---------+-----------------+-----------------------+
|   7.95 |  477.00 |  128            |                 16.10 |
+--------+---------+-----------------+-----------------------+&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;src: https://severalnines.com/database-blog/improve-performance-galera-cluster-mysql-or-mariadb&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id=&quot;grastate-dat&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#grastate-dat&quot; aria-label=&quot;Anchor link for: grastate-dat&quot;&gt;🔗&lt;/a&gt;grastate.dat&lt;/h2&gt;
&lt;p&gt;Try to recover from the node with max &lt;code&gt;seqno&lt;/code&gt;, for example this is a node that shows a graceful shutdown:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;version: 2.1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;uuid: cbd332a9-f617-11e2-b77d-3ee9fa637069&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;seqno: 43760&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This &lt;code&gt;grastate.dat&lt;/code&gt; file shows &lt;code&gt;-1&lt;/code&gt; in the &lt;code&gt;seqno&lt;/code&gt;. This node crashed during transaction processing:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;version: 2.1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;uuid: cbd332a9-f617-11e2-b77d-3ee9fa637069&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;seqno: -1&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This node crashed during DDL:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;version: 2.1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;uuid: 00000000-0000-0000-0000-000000000000&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;seqno: -1&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>galera alter</title>
        <published>2019-01-29T22:50:24+01:00</published>
        <updated>2019-01-29T22:50:24+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/galera-alter/"/>
        <id>https://nbari.com/galera-alter/</id>
        
        <content type="html" xml:base="https://nbari.com/galera-alter/">&lt;p&gt;To prevent bloking the cluster while doing &lt;code&gt;ALTERS&lt;/code&gt; (SCHEMA UPGRADES), do this per node:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SET GLOBAL wsrep_OSU_method=&amp;#39;RSU&amp;#39;;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then Run the &lt;code&gt;ALTER&lt;/code&gt; statement once done reset the Schema Upgrade method back to
Total Order Isolation.&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SET GLOBAL wsrep_OSU_method=&amp;#39;TOI&amp;#39;;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;http://galeracluster.com/documentation-webpages/clusterstallonalter.html
http://galeracluster.com/documentation-webpages/schemaupgrades.html&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>mojave Iso</title>
        <published>2018-12-13T20:47:37+01:00</published>
        <updated>2018-12-13T20:47:37+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/mojave-iso/"/>
        <id>https://nbari.com/mojave-iso/</id>
        
        <content type="html" xml:base="https://nbari.com/mojave-iso/">&lt;p&gt;Create 12 GB tmp disk:
hdiutil create -o /tmp/Mojave.cdr -size 12000m -layout SPUD -fs HFS+J&lt;/p&gt;
&lt;p&gt;Attach the disk:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;hdiutil attach /tmp/Mojave.cdr.dmg -noverify -mountpoint /Volumes/install_build&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Extract the installer:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sudo /Applications/Install\ macOS\ Mojave.app/Contents/Resources/createinstallmedia --volume /Volumes/install_build&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Create the iso&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mv /tmp/Mojave.cdr.dmg ~/Desktop/InstallSystem.dmg&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;hdiutil detach /Volumes/Install\ macOS\ Mojave&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;hdiutil convert ~/Desktop/InstallSystem.dmg -format UDTO -o ~/Desktop/Mojave.iso&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Rename &lt;code&gt;Mojave.iso.cdr&lt;/code&gt; to &lt;code&gt;Mojave.iso&lt;/code&gt;&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>jamf</title>
        <published>2018-12-12T08:22:37+01:00</published>
        <updated>2018-12-12T08:22:37+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/jamf/"/>
        <id>https://nbari.com/jamf/</id>
        
        <content type="html" xml:base="https://nbari.com/jamf/">&lt;p&gt;&lt;code&gt;softwareupdate -l&lt;/code&gt; to see if there are macOS updates available.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;softwareupdate -ia&lt;/code&gt; to install all updates.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;sudo jamf policy&lt;/code&gt; to run all outstanding policies and updates for the apps,&lt;/p&gt;
&lt;p&gt;&lt;code&gt;sudo jamf recon&lt;/code&gt; to update the inventory on the server.&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>stty</title>
        <published>2018-12-10T11:02:33+01:00</published>
        <updated>2018-12-10T11:02:33+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/stty/"/>
        <id>https://nbari.com/stty/</id>
        
        <content type="html" xml:base="https://nbari.com/stty/">&lt;p&gt;If &lt;code&gt;reset&lt;/code&gt; can&#39;t clean your terminal, give a try to:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;stty sane&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>tmux</title>
        <published>2018-12-07T13:57:16+01:00</published>
        <updated>2018-12-07T13:57:16+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/tmux/"/>
        <id>https://nbari.com/tmux/</id>
        
        <content type="html" xml:base="https://nbari.com/tmux/">&lt;p&gt;Set window title:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;c-b&amp;gt;,&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Get pannel number:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;c-b&amp;gt;q&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Show clock:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;c-b&amp;gt;t&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Move pane to a new window:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;c-b&amp;gt;!&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Join panes:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;c-b&amp;gt;: join-pane -s 0 -t 3  move pane 1 to window 3&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;c-b&amp;gt;: join-pane -t :1      move current pane to window 1&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Create a new session:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;c-b&amp;gt;: new -s &amp;lt;name&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;List sessions:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;c-b&amp;gt;s&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;c-b&amp;gt;w  expanded&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Move pane to a another session:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;c-b&amp;gt;m              mark the pane&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;c-b&amp;gt;w              go to the destination window/session&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;c-b&amp;gt;: join-pane&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;or go to the pane you want to move, check the session name and windows you would like to move and try:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;c-b&amp;gt;: move-pane -t docker:0&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;docker is the name of the session and 0 the window&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Split full window:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;c-b&amp;gt;: split-window -fv      like &amp;lt;c-b&amp;gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;c-b&amp;gt;: split-window -fh      like &amp;lt;c-b&amp;gt;%&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Rotate panes:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;c-b&amp;gt;&amp;lt;c-o&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;List buffers:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;c-b&amp;gt;=&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Disconnect / Detach users:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;c-b&amp;gt;D&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Attach to an existing session:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;tmux a -t &amp;lt;name of session&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Block SSH on MacOS</title>
        <published>2018-12-01T09:44:00+01:00</published>
        <updated>2018-12-01T09:44:00+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/block-ssh-mac/"/>
        <id>https://nbari.com/block-ssh-mac/</id>
        
        <content type="html" xml:base="https://nbari.com/block-ssh-mac/">&lt;p&gt;To block incoming ssh connections, edit the &lt;code&gt;/etc/pf.conf&lt;/code&gt; and add the following
line at the bottom:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;block in log quick proto tcp from any to any port 22&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You can use vim or use something like this:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sudo sh -c &amp;quot;echo &amp;#39;block in log quick proto tcp from any to any port 22&amp;#39; &amp;gt;&amp;gt; /etc/pf.conf&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then reload the pfrules:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sudo pfctl -Fa -f /etc/pf.conf&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;For this to work the firewall must be enabled.&lt;/p&gt;
&lt;p&gt;Example of how file looks after the rule has been added: &lt;code&gt;cat /etc/pf.conf&lt;/code&gt;&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;#&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Default PF configuration file.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;#&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# This file contains the main ruleset, which gets automatically loaded&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# at startup.  PF will not be automatically enabled, however.  Instead,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# each component which utilizes PF is responsible for enabling and disabling&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# PF via -E and -X as documented in pfctl(8).  That will ensure that PF&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# is disabled only when the last enable reference is released.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;#&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Care must be taken to ensure that the main ruleset does not get flushed,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# as the nested anchors rely on the anchor point defined here. In addition,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# to the anchors loaded by this file, some system services would dynamically&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# insert anchors into the main ruleset. These anchors will be added only when&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# the system service is used and would removed on termination of the service.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;#&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# See pf.conf(5) for syntax.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;#&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;#&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# com.apple anchor point&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;#&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;scrub-anchor &amp;quot;com.apple/*&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;nat-anchor &amp;quot;com.apple/*&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;rdr-anchor &amp;quot;com.apple/*&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dummynet-anchor &amp;quot;com.apple/*&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;anchor &amp;quot;com.apple/*&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;load anchor &amp;quot;com.apple&amp;quot; from &amp;quot;/etc/pf.anchors/com.apple&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# block incoming ssh&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;block in log quick proto tcp from any to any port 22&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Processlist</title>
        <published>2018-11-12T20:10:04+01:00</published>
        <updated>2018-11-12T20:10:04+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/processlist/"/>
        <id>https://nbari.com/processlist/</id>
        
        <content type="html" xml:base="https://nbari.com/processlist/">&lt;p&gt;Run &lt;code&gt;show processlist&lt;/code&gt; every second:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mysqladmin -uroot -p -i 1 processlist&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;-i 1&lt;/code&gt; stands for interval one second&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>OSI TLS</title>
        <published>2018-11-07T18:49:10+01:00</published>
        <updated>2018-11-07T18:49:10+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/osi-tls/"/>
        <id>https://nbari.com/osi-tls/</id>
        
        <content type="html" xml:base="https://nbari.com/osi-tls/">&lt;p&gt;Beside the OSI/model, there is also the TCP/IP Model:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Link Layer&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Internet (IP) Layer&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Transport Layer&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Application&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/img/tcp-ip-model.png&quot; alt=&quot;tcp-ip-model&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h1 id=&quot;osi-model&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#osi-model&quot; aria-label=&quot;Anchor link for: osi-model&quot;&gt;🔗&lt;/a&gt;OSI Model&lt;/h1&gt;
&lt;p&gt;The OSI model has a bit more granularity.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Physical Layer&lt;/li&gt;
&lt;li&gt;Data Link Layer&lt;/li&gt;
&lt;li&gt;Network Layer (IP)&lt;/li&gt;
&lt;li&gt;Transport Layer (TCP)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Session Layer (TLS)&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Presentation Layer&lt;/li&gt;
&lt;li&gt;Application Layer (HTTP)&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;TLS establishes an encrypted session. In the OSI model this is where TLS
operates. It sets up its session, and adds a layer of encryption for the
Application Layer (HTTP).&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;TLS and SSL do not fit neatly into any single layer of the OSI model or the TCP/IP model. TLS runs &quot;on top of some reliable transport protocol (e.g., TCP),&quot; which would imply that it is above the transport layer. It serves encryption to higher layers, which is normally the function of the presentation layer. However, applications generally use TLS as if it were a transport layer, even though applications using TLS must actively control initiating TLS handshakes and handling of exchanged authentication certificates. https://en.wikipedia.org/wiki/Transport_Layer_Security&lt;/p&gt;
&lt;/blockquote&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>IRC</title>
        <published>2018-11-02T11:18:13+01:00</published>
        <updated>2018-11-02T11:18:13+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/irc/"/>
        <id>https://nbari.com/irc/</id>
        
        <content type="html" xml:base="https://nbari.com/irc/">&lt;p&gt;Change password password in irc:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;/msg nickserv set password &amp;lt;password&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>combine two images</title>
        <published>2018-10-17T12:39:11+02:00</published>
        <updated>2018-10-17T12:39:11+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/combine-two-images/"/>
        <id>https://nbari.com/combine-two-images/</id>
        
        <content type="html" xml:base="https://nbari.com/combine-two-images/">&lt;p&gt;Combine in a single file 2 images:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;convert +append a.png b.png out.png&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;-append&lt;/code&gt; will append vertically instead of horizontally (&lt;code&gt;+&lt;/code&gt;)&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>LS_COLORS</title>
        <published>2018-09-06T13:41:33+02:00</published>
        <updated>2018-09-06T13:41:33+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/ls-colors/"/>
        <id>https://nbari.com/ls-colors/</id>
        
        <content type="html" xml:base="https://nbari.com/ls-colors/">&lt;p&gt;To remove the blinking of symbolic links when doing &lt;code&gt;ls&lt;/code&gt; in Linux:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;LS_COLORS=&amp;quot;ln=35&amp;quot; export LS_COLORS&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;That will set the &lt;code&gt;ln=35&lt;/code&gt; symbolic links to color purple.&lt;/p&gt;
&lt;p&gt;Params for &lt;code&gt;LS_COLORS&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;di  Directory&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;fi  File&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ln  Symbolic Link&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pi  Fifo file&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;so  Socket file&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;bd  Block (buffered) special file&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cd  Character (unbuffered) special file&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;or  Symbolic Link pointing to a non-existent file (orphan)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mi  Non-existent file pointed to by a symbolic link (visible when you type ls -l)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ex  File which is executable (ie. has &amp;#39;x&amp;#39; set in permissions).&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Another way is to edit &lt;code&gt;~/.dircolors&lt;/code&gt;  and replace the &lt;code&gt;05&lt;/code&gt; (blinking) for example:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ORPHAN  05;37;45&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;MISSING 05;37;45&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Change to:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ORPHAN  35&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;MISSING 35&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>htpasswd</title>
        <published>2018-09-02T11:50:26+02:00</published>
        <updated>2018-09-02T11:50:26+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/htpasswd/"/>
        <id>https://nbari.com/htpasswd/</id>
        
        <content type="html" xml:base="https://nbari.com/htpasswd/">&lt;p&gt;To create an &lt;code&gt;htpasswd&lt;/code&gt; file (for htaccess &quot;authentication&quot;) using &lt;code&gt;openssl&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ printf &amp;quot;foo:$(openssl passwd -apr1 PASSWORD)\n&amp;quot; &amp;gt;&amp;gt; .htpasswd&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If need to use &lt;code&gt;crypt&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ printf &amp;quot;foo:$(openssl passwd -crypt PASSWORD)\n&amp;quot; &amp;gt;&amp;gt; .htpasswd&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Git SSH</title>
        <published>2018-08-29T16:26:34+02:00</published>
        <updated>2018-08-29T16:26:34+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/git-ssh/"/>
        <id>https://nbari.com/git-ssh/</id>
        
        <content type="html" xml:base="https://nbari.com/git-ssh/">&lt;p&gt;To create a git repository and access to it via ssh:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ ssh your.host&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ mkdir my-new-repo&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ cd my-new-repo&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ git --bare init&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To access your repo (clone it):&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ git clone ssh://user@your.host:2222/~user/my-new-repo&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>self CA</title>
        <published>2018-08-27T12:33:05+02:00</published>
        <updated>2018-08-27T12:33:05+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/self-ca/"/>
        <id>https://nbari.com/self-ca/</id>
        
        <content type="html" xml:base="https://nbari.com/self-ca/">&lt;p&gt;Create a self signed CA (Certificate Authority)&lt;/p&gt;
&lt;p&gt;Generate private key:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ openssl genrsa -des3 -out CA.key 4096&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To create a private key without password:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ openssl genrsa -out CA.key 4096&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Create a root certificate:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ openssl req -x509 -new -nodes -key CA.key -sha256 -out CA.pem -subj &amp;quot;/CN=example.com&amp;quot; -days 365&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In one single command create the private key and the certificate:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ openssl req -x509 -newkey rsa:4096 -sha256 -nodes -keyout CA.key -out CA.pem -subj &amp;quot;/CN=myCA.tld&amp;quot; -days 365&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Import this cert in your system (trust it)&lt;/p&gt;
&lt;h2 id=&quot;create-certificates-to-be-signed-with-your-ca&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#create-certificates-to-be-signed-with-your-ca&quot; aria-label=&quot;Anchor link for: create-certificates-to-be-signed-with-your-ca&quot;&gt;🔗&lt;/a&gt;Create certificates to be signed with your CA:&lt;/h2&gt;
&lt;p&gt;Create a certificate requests &lt;code&gt;.csr&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ mkdir example.tld&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ cd example.tld&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ openssl req -newkey rsa:4096 -sha256 -nodes -keyout example.key -out example.csr -subj &amp;quot;/CN=example.tld&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Sign the certificate with the &lt;code&gt;CA&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ openssl x509 -days 3065 -sha256 -req -in example.csr -CA ../CA.pem -CAkey ../CA.key -set_serial 01 -out example.tld.crt&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Bosh cheatsheet</title>
        <published>2018-08-23T11:26:21+02:00</published>
        <updated>2018-08-23T11:26:21+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/bosh-cheatsheet/"/>
        <id>https://nbari.com/bosh-cheatsheet/</id>
        
        <content type="html" xml:base="https://nbari.com/bosh-cheatsheet/">&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://bosh.io/&quot;&gt;BOSH&lt;/a&gt; is a project that unifies release engineering, deployment, and lifecycle management of small and large-scale cloud software.&lt;/p&gt;
&lt;p&gt;Check your environment:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ bosh env&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Set your deployment environment:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ export BOSH_DEPLOYMENT=foo&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;if have multiple deployments in same &lt;code&gt;dir&lt;/code&gt; better to use -d
&lt;code&gt;&amp;lt;deployment-name&amp;gt;&lt;/code&gt; since many commands are bound to this variable.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;To recreate your environment (virtualbox), remove the line that start with
&lt;code&gt;current_manifest&lt;/code&gt; from the file &lt;code&gt;state.json&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ sed -i &amp;quot;&amp;quot; &amp;#39;/current_manifest_sha/d&amp;#39; state.json&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Deploy your manifest:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ bosh deploy deployments/foo.yml&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Check your instances:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ bosh instances&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To check processes within instances:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ bosh instances --ps&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;this is the output of &lt;code&gt;monit summary&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;To ssh into the instance of your deployment:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ bosh ssh&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If you have multiple instances:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ bosh ssh worker/C17C59B3-FE07-4BAE-BD51-398010295BAD&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To login without the &lt;code&gt;uuid&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ bosh ssh worker/0&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Show all your deployments:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ bosh deployments&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Follow logs via ssh:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ bosh logs -f&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Get logs only for a specifying &lt;code&gt;job&lt;/code&gt; (&lt;code&gt;/var/vcap/jobs/&amp;lt;job name&amp;gt;&lt;/code&gt;):&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ bosh logs -f --job foo&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Within an instance:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# tail -f /var/vcap/sys/log/{*.log,*/*.log}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;View a BOSH director&#39;s Cloud Config:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ bosh cloud-config&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Update params in default config:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ bosh cloud-config &amp;gt; cloud.yml&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Do you changes and then update the config:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ bosh update-cloud-config cloud.yml&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Update the running manifest:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ bosh -d &amp;lt;your-deployment&amp;gt; manifest &amp;gt; manifest.yml&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Do your changes and then re-deploy:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ bosh -d &amp;lt;your-deployment&amp;gt; deploy manifest.yml&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;List available stemcells:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ bosh stemcells&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Get recent tasks&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ bosh tasks --recent&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Debug output for a task:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ bosh task &amp;lt;id&amp;gt; --debug&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h1 id=&quot;bosh-lite&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#bosh-lite&quot; aria-label=&quot;Anchor link for: bosh-lite&quot;&gt;🔗&lt;/a&gt;Bosh-lite&lt;/h1&gt;
&lt;p&gt;To add more cpu, memory to the VM within virtualbox, edit &lt;code&gt;virtualbox/cpi.yml&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;diff&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;    cpus: 2&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;    memory: 4096&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;    ephemeral_disk: 16_384&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;    cpus: 6&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;    memory: 16_384&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;    ephemeral_disk: 51_200&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To suspend (prevent bosh not starting when rebooting):&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;#!/bin/sh&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;VBoxManage controlvm $(jq -r &amp;#39;.current_vm_cid&amp;#39; state.json) savestate&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To start:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;#!/bin/sh&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;VBoxManage startvm $(jq -r &amp;#39;.current_vm_cid&amp;#39; state.json) --type headless&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h1 id=&quot;delete-every-orphaned-disk&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#delete-every-orphaned-disk&quot; aria-label=&quot;Anchor link for: delete-every-orphaned-disk&quot;&gt;🔗&lt;/a&gt;Delete every orphaned disk&lt;/h1&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;bosh disks --orphaned | awk &amp;#39;NR&amp;gt;0 {print $1}&amp;#39; |  xargs -L1 bosh delete-disk -n&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# or&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;bosh disks --orphaned | awk &amp;#39;$1 ~ /^disk-/ {print $1}&amp;#39; | xargs -L1 bosh delete-disk -n&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To clean all including orphaned disks:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;bosh clean-up --all&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>ZFS swap</title>
        <published>2018-08-20T20:51:31+02:00</published>
        <updated>2018-08-20T20:51:31+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/zfs-swap/"/>
        <id>https://nbari.com/zfs-swap/</id>
        
        <content type="html" xml:base="https://nbari.com/zfs-swap/">&lt;p&gt;To add more swap on a ZFS system:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# zfs create -V 64G -o org.freebsd:swap=on -o checksum=off -o compression=off -o dedup=off -o sync=disabled -o primarycache=none tank/swap2&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To add it:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# swapon /dev/zvol/tank/swap2&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To resize you could first remove it:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# swapoff /dev/zvol/tank/swap&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then destroy it:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# zfs destroy tank/swap&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>No history</title>
        <published>2018-08-11T15:59:53+02:00</published>
        <updated>2018-08-11T15:59:53+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/no-history/"/>
        <id>https://nbari.com/no-history/</id>
        
        <content type="html" xml:base="https://nbari.com/no-history/">&lt;p&gt;To avoid having command in history just prefix them with an empty space:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$⎵ uname&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If using &lt;code&gt;zsh&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ echo &amp;quot;&amp;quot; &amp;gt; ~/.zsh_history &amp;amp; exec $SHELL -l&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>macOs sparseimage</title>
        <published>2018-08-10T11:55:08+02:00</published>
        <updated>2018-08-10T11:55:08+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/macos-sparseimage/"/>
        <id>https://nbari.com/macos-sparseimage/</id>
        
        <content type="html" xml:base="https://nbari.com/macos-sparseimage/">&lt;p&gt;To create an install disk using an spare disk:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ hdiutil create -size 6GB -fs JHFS+ -volname &amp;quot;macOS_installmedia&amp;quot; -type SPARSE ~/Desktop/macOS_installmedia&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Mount it (or double-click in Finder to mount):&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ hdiutil mount ~/Desktop/macOS_installmedia.sparseimage&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Use the &lt;code&gt;createinstallmedia&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ sudo /Applications/Install\ macOS\ High\ Sierra.app/Contents/Resources/createinstallmedia --volume /Volumes/macOS_installmedia --applicationpath /Applications/Install\ macOS\ High\ Sierra.app&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>NATO phonetic alphabet</title>
        <published>2018-07-28T07:19:51+02:00</published>
        <updated>2018-07-28T07:19:51+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/nato-phonetic-alphabet/"/>
        <id>https://nbari.com/nato-phonetic-alphabet/</id>
        
        <content type="html" xml:base="https://nbari.com/nato-phonetic-alphabet/">&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th style=&quot;text-align: center&quot;&gt;Symbol&lt;/th&gt;&lt;th&gt;Code word&lt;/th&gt;&lt;th&gt;Pronunciation&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;A&lt;/td&gt;&lt;td&gt;Alfa&lt;/td&gt;&lt;td&gt;Al fah&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;B&lt;/td&gt;&lt;td&gt;Bravo&lt;/td&gt;&lt;td&gt;Brah Voh&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;C&lt;/td&gt;&lt;td&gt;Charlie&lt;/td&gt;&lt;td&gt;Char Lee&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;D&lt;/td&gt;&lt;td&gt;Delta&lt;/td&gt;&lt;td&gt;Dell Tah&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;E&lt;/td&gt;&lt;td&gt;Echo&lt;/td&gt;&lt;td&gt;Eck Oh&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;F&lt;/td&gt;&lt;td&gt;Fox&lt;/td&gt;&lt;td&gt;Foks Trot&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;G&lt;/td&gt;&lt;td&gt;Golf&lt;/td&gt;&lt;td&gt;Golf&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;H&lt;/td&gt;&lt;td&gt;Hotel&lt;/td&gt;&lt;td&gt;Hoh Tell&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;I&lt;/td&gt;&lt;td&gt;India&lt;/td&gt;&lt;td&gt;In Dee Ah&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;J&lt;/td&gt;&lt;td&gt;Juliett&lt;/td&gt;&lt;td&gt;Jew Lee Ett&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;K&lt;/td&gt;&lt;td&gt;Kilo&lt;/td&gt;&lt;td&gt;Key Loh&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;L&lt;/td&gt;&lt;td&gt;Lima&lt;/td&gt;&lt;td&gt;Lee Mah&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;M&lt;/td&gt;&lt;td&gt;Mike&lt;/td&gt;&lt;td&gt;Mike&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;N&lt;/td&gt;&lt;td&gt;November&lt;/td&gt;&lt;td&gt;No Vem Ber&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;O&lt;/td&gt;&lt;td&gt;Oscar&lt;/td&gt;&lt;td&gt;Oss Car&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;P&lt;/td&gt;&lt;td&gt;Papa&lt;/td&gt;&lt;td&gt;Pah Pah&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;Q&lt;/td&gt;&lt;td&gt;Quebec&lt;/td&gt;&lt;td&gt;Keh Beck&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;R&lt;/td&gt;&lt;td&gt;Romeo&lt;/td&gt;&lt;td&gt;Row Me Oh&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;S&lt;/td&gt;&lt;td&gt;Sierra&lt;/td&gt;&lt;td&gt;See Air Ah&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;T&lt;/td&gt;&lt;td&gt;Tango&lt;/td&gt;&lt;td&gt;Tang Go&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;U&lt;/td&gt;&lt;td&gt;Uniform&lt;/td&gt;&lt;td&gt;You Nee Form&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;V&lt;/td&gt;&lt;td&gt;Victor&lt;/td&gt;&lt;td&gt;Vik Tah&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;W&lt;/td&gt;&lt;td&gt;Whiskey&lt;/td&gt;&lt;td&gt;Wiss Key&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;X&lt;/td&gt;&lt;td&gt;X-ray&lt;/td&gt;&lt;td&gt;Ecks Ray&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;Y&lt;/td&gt;&lt;td&gt;Yankee&lt;/td&gt;&lt;td&gt;Yang Key&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;Z&lt;/td&gt;&lt;td&gt;Zulu&lt;/td&gt;&lt;td&gt;Zoo Loo&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;0&lt;/td&gt;&lt;td&gt;Zero&lt;/td&gt;&lt;td&gt;Zee Row&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;1&lt;/td&gt;&lt;td&gt;One&lt;/td&gt;&lt;td&gt;Wun&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;2&lt;/td&gt;&lt;td&gt;Two&lt;/td&gt;&lt;td&gt;Too&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;3&lt;/td&gt;&lt;td&gt;Three&lt;/td&gt;&lt;td&gt;Tree&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;4&lt;/td&gt;&lt;td&gt;Four&lt;/td&gt;&lt;td&gt;Fow Er&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;5&lt;/td&gt;&lt;td&gt;Five&lt;/td&gt;&lt;td&gt;Fife&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;6&lt;/td&gt;&lt;td&gt;Six&lt;/td&gt;&lt;td&gt;Six&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;7&lt;/td&gt;&lt;td&gt;Seven&lt;/td&gt;&lt;td&gt;Sev En&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;8&lt;/td&gt;&lt;td&gt;Eight&lt;/td&gt;&lt;td&gt;Ait&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;9&lt;/td&gt;&lt;td&gt;Nine&lt;/td&gt;&lt;td&gt;Nine Er&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>ZFS send receive</title>
        <published>2018-06-21T12:00:34+02:00</published>
        <updated>2018-06-21T12:00:34+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/zfs-send-receive/"/>
        <id>https://nbari.com/zfs-send-receive/</id>
        
        <content type="html" xml:base="https://nbari.com/zfs-send-receive/">&lt;p&gt;To send a &lt;code&gt;zfs&lt;/code&gt; dataset being no root, on the origin server:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# zfs allow -g wheel send,snapshot,hold tank/foo&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;On the receiver, create the dataset and allow users in group wheel:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# zfs create -o mountpoint=/foo tank/foo&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# zfs allow -g wheel compression,mountpoint,create,mount,receive tank/foo&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# umount /foo&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;On the origin server create the snapshot to send:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# zfs snapshot -r tank/foo&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;On the origin server send the dataset by using:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ zfs send -Rc tank/foo@today | ssh -p 23 nbari@X.X.X.X &amp;#39;zfs receive -sFvu tank/foo&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;-c&lt;/code&gt; is for compress&quot; on the origin,  and &lt;code&gt;-s&lt;/code&gt; to resume on the receiver if ssh goes down&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Then you may need to mount it on the receiver:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# zfs mount tank/foo&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h1 id=&quot;pbzip&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#pbzip&quot; aria-label=&quot;Anchor link for: pbzip&quot;&gt;🔗&lt;/a&gt;pbzip&lt;/h1&gt;
&lt;p&gt;To send the dataset locally:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# zfs send -Rv tank/vmail@today | pbzip &amp;gt; vmail.bz2&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To receive:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# pbzip2 -dc | zfs receive -Fv tank/vmail&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Enable Paste</title>
        <published>2018-06-19T19:55:16+02:00</published>
        <updated>2018-06-19T19:55:16+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/enable-paste/"/>
        <id>https://nbari.com/enable-paste/</id>
        
        <content type="html" xml:base="https://nbari.com/enable-paste/">&lt;p&gt;To enable paste in chrome, open the console and enter:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;var allowPaste = function(e){&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  e.stopImmediatePropagation();&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  return true;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;};&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;document.addEventListener(&amp;#39;paste&amp;#39;, allowPaste, true);&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>kld_list</title>
        <published>2018-06-15T09:46:25+02:00</published>
        <updated>2018-06-15T09:46:25+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/kld-list/"/>
        <id>https://nbari.com/kld-list/</id>
        
        <content type="html" xml:base="https://nbari.com/kld-list/">&lt;p&gt;To load kernel modules after local disks are mounted add this to &lt;code&gt;/etc/rc.conf&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;kld_list=&amp;quot;fuse&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;in this case module fuse will be loaded&lt;/p&gt;
&lt;/blockquote&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>hw.(machine|model|ncpu)</title>
        <published>2018-06-13T15:27:01+02:00</published>
        <updated>2018-06-13T15:27:01+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/hw-machine-model-ncpu/"/>
        <id>https://nbari.com/hw-machine-model-ncpu/</id>
        
        <content type="html" xml:base="https://nbari.com/hw-machine-model-ncpu/">&lt;p&gt;To get an overview of the system:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# sysctl -a | egrep -i &amp;#39;hw.machine|hw.model|hw.ncpu&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;hw.machine: amd64&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;hw.model: Intel(R) Xeon(R) Silver 4110 CPU @ 2.10GHz&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;hw.ncpu: 16&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;hw.machine_arch: amd64&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>moosefs</title>
        <published>2018-06-12T21:29:49+02:00</published>
        <updated>2018-06-12T21:29:49+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/moosefs/"/>
        <id>https://nbari.com/moosefs/</id>
        
        <content type="html" xml:base="https://nbari.com/moosefs/">&lt;p&gt;Create a small distributed file system using 2 servers one acting as a mater/chunkserver and other only as a chunkserver.&lt;/p&gt;
&lt;p&gt;Install the required packages:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pkg install moosefs3-cgi moosefs3-cgiserv moosefs3-chunkserver moosefs3-client&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;For the master just add:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pkg install moosefs3-master&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In all the servers add to your &lt;code&gt;/etc/hosts&lt;/code&gt; and entry for the &lt;code&gt;mfsmaster&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;X.X.X.X     mfsmaster&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Before starting the master, crate the file &lt;code&gt;/var/mfs/metadata.mfs&lt;/code&gt; with:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;MFSM NEW&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Create a pool to share:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;zfs create tank/mfs -o mountpoint=/mfs tank/mfs&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;chown mfs:mfs /mfs&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;chmod 770 /mfs&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Add to &lt;code&gt;/usr/local/etc/mfs/mfshdd.cfg&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;/mfs&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And to &lt;code&gt;/etc/fstab&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mfsmount_magic  /mnt/mfs moosefs  rw,mfsmaster=mfsmaster,mfscachemode=DIRECT,mountprog=/usr/local/bin/mfsmount,failok  0  0&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;notice the &lt;code&gt;failok&lt;/code&gt; it will allow to boot in case master is down&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;As an alternative to &lt;code&gt;/etc/fstab&lt;/code&gt;, edit &lt;code&gt;/usr/local/etc/mfs/mfsmount.cfg&lt;/code&gt; with something like:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;rw&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mfsmaster=mfsmaster&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mfscachemode=DIRECT&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;/mnt/mfs&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then just by typing &lt;code&gt;mfsmount&lt;/code&gt; will mount it.&lt;/p&gt;
&lt;p&gt;Create the mount point:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mkdir /mnt/mfs&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Add to &lt;code&gt;/etc/rc.conf&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mfscgiserv_enable=&amp;quot;YES&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mfschunkserver_enable=&amp;quot;YES&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And for the mater:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mfsmaster_enable=&amp;quot;YES&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then load &lt;code&gt;fuse&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;kldload fuse&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Or by adding it to &lt;code&gt;/boot/loader.conf&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;fuse_load=&amp;quot;YES&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;reboot and try to access: http://x.x.x.x:9425/mfs.cgi you should see the moosefs admin page, also try to check your mount points, change to &lt;code&gt;/mnt/mfs&lt;/code&gt; and give a try:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dd if=/dev/zero of=/mnt/mfs/testfile bs=1G count=1&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In both server you may have the same file, to check the directory info:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mfsdirinfo -l *&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>MANIFEST No Such File or Directory</title>
        <published>2018-06-12T12:28:36+02:00</published>
        <updated>2018-06-12T12:28:36+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/manifest-no-such-file-or-directory/"/>
        <id>https://nbari.com/manifest-no-such-file-or-directory/</id>
        
        <content type="html" xml:base="https://nbari.com/manifest-no-such-file-or-directory/">&lt;p&gt;If when trying to install FreeBSD using &lt;code&gt;bsdinstall&lt;/code&gt; you get:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;quot;Error while fetching file:///usr/freebsd-dist/MANIFEST&amp;quot; - no such file or directory&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Try to:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;root@rescue:~ # mkdir -p /usr/freebsd-dist/&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;root@rescue:~ # touch /usr/freebsd-dist/MANIFEST&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And then start again&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>ctrl-backslash</title>
        <published>2018-06-11T17:49:59+02:00</published>
        <updated>2018-06-11T17:49:59+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/ctrl-backslash/"/>
        <id>https://nbari.com/ctrl-backslash/</id>
        
        <content type="html" xml:base="https://nbari.com/ctrl-backslash/">&lt;p&gt;To send a quit signal to the process:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ctrl-\ # (backslash)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This will send a &lt;code&gt;SIGQUIT&lt;/code&gt;&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>python site packages</title>
        <published>2018-06-07T14:22:46+02:00</published>
        <updated>2018-06-07T14:22:46+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/site-packages/"/>
        <id>https://nbari.com/site-packages/</id>
        
        <content type="html" xml:base="https://nbari.com/site-packages/">&lt;p&gt;To find the python &lt;code&gt;site-packages&lt;/code&gt; paths:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ python -m site&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>DNS TCP</title>
        <published>2018-06-01T07:25:42+02:00</published>
        <updated>2018-06-01T07:25:42+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/dns-tcp/"/>
        <id>https://nbari.com/dns-tcp/</id>
        
        <content type="html" xml:base="https://nbari.com/dns-tcp/">&lt;p&gt;Unbound using DNS over TCP:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;server:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;private-domain: &amp;quot;plex.direct&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;forward-zone:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  name: &amp;quot;.&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  forward-ssl-upstream: yes&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  forward-addr: 1.1.1.1@853&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  forward-addr: 9.9.9.9@853&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  forward-addr: 1.0.0.1@853&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  forward-addr: 149.112.112.112@853&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  forward-addr: 2606:4700:4700::1111@853&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  forward-addr: 2606:4700:4700::1001@853&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  forward-addr: 2620:fe::fe@853;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  forward-addr: 2620:fe::9@853;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To test do:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# unbound-control -c /var/unbound/unbound.conf lookup .&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It should return something like:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;The following name servers are used for lookup of .&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;forwarding request:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Delegation with 0 names, of which 0 can be examined to query further addresses.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;It provides 8 IP addresses.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;1.1.1.1                 rto 401 msec, ttl 880, ping 33 var 92 rtt 401, tA 0, tAAAA 0, tother 0, EDNS 0 assumed.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;9.9.9.9                 not in infra cache.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;1.0.0.1                 rto 397 msec, ttl 899, ping 13 var 96 rtt 397, tA 0, tAAAA 0, tother 0, EDNS 0 assumed.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;149.112.112.112         rto 418 msec, ttl 880, ping 58 var 90 rtt 418, tA 0, tAAAA 0, tother 0, EDNS 0 assumed.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;2606:4700:4700::1111    rto 376 msec, ttl 880, ping 0 var 94 rtt 376, tA 0, tAAAA 0, tother 0, EDNS 0 assumed.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;2606:4700:4700::1001    rto 376 msec, ttl 888, ping 0 var 94 rtt 376, tA 0, tAAAA 0, tother 0, EDNS 0 assumed.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;2620:fe::fe             rto 376 msec, ttl 884, ping 0 var 94 rtt 376, tA 0, tAAAA 0, tother 0, EDNS 0 assumed.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;2620:fe::9              rto 376 msec, ttl 899, ping 0 var 94 rtt 376, tA 0, tAAAA 0, tother 0, EDNS 0 assumed.&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>ssh CanonicalDomains</title>
        <published>2018-05-30T12:22:23+02:00</published>
        <updated>2018-05-30T12:22:23+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/ssh-canonicaldomains/"/>
        <id>https://nbari.com/ssh-canonicaldomains/</id>
        
        <content type="html" xml:base="https://nbari.com/ssh-canonicaldomains/">&lt;p&gt;SSH Canonicalization&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;CanonicalDomains example.com example.net example.org&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# CanonicalizeFallbackLocal no&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;CanonicalizeHostname yes&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Host *.example.com&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	IdentityFile ~/.ssh/exampleCOM&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	User foo&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Host *.example.net&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	IdentityFile ~/.ssh/exampleNET&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	User foo&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Host *.example.org&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	User foo&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	IdentityFile ~/.ssh/exampleORG&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;more info: https://dotfiles.tnetconsulting.net/articles/2016/0109/ssh-canonicalization.html&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>pfsense</title>
        <published>2018-05-29T21:40:18+02:00</published>
        <updated>2018-05-29T21:40:18+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/pfsense/"/>
        <id>https://nbari.com/pfsense/</id>
        
        <content type="html" xml:base="https://nbari.com/pfsense/">&lt;p&gt;How to connect using serial (usb/com RJ45) port on macOS:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ sudo cu -s 115200 -l /dev/tty.usbserial-DN04FSAL&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To bail out when you&#39;re done, type &lt;code&gt;~.&lt;/code&gt; as you would with SSH.&lt;/p&gt;
&lt;p&gt;Boot example:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/img/pfsense-serial-1.png&quot; alt=&quot;pfsense boot&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;&lt;/p&gt;
&lt;p&gt;After installing (zfs on root):&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/img/pfsense-serial-2.png&quot; alt=&quot;pfsense setup&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;&lt;/p&gt;
&lt;p&gt;The toy:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/img/pfsense-fw4.jpg&quot; alt=&quot;pfsense fw4a&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>packagecloud</title>
        <published>2018-05-28T11:22:19+02:00</published>
        <updated>2018-05-28T11:22:19+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/packagecloud/"/>
        <id>https://nbari.com/packagecloud/</id>
        
        <content type="html" xml:base="https://nbari.com/packagecloud/">&lt;p&gt;To upload all packages to packagecloud:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;package_cloud push immortal/immortal/el/7 immortal_0.19.0_*.rpm --skip-errors&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;for .deb 386 needs to be i386&lt;/p&gt;
&lt;/blockquote&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>gzip</title>
        <published>2018-05-25T20:48:09+02:00</published>
        <updated>2018-05-25T20:48:09+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/gzip/"/>
        <id>https://nbari.com/gzip/</id>
        
        <content type="html" xml:base="https://nbari.com/gzip/">&lt;p&gt;Gzip all files within a directory:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gzip -r ./&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;or&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;find . -type f ! -name &amp;#39;*.gz&amp;#39; -exec gzip &amp;quot;{}&amp;quot; \;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>odroid C2</title>
        <published>2018-05-15T01:06:41+02:00</published>
        <updated>2018-05-15T01:06:41+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/odroid-c2/"/>
        <id>https://nbari.com/odroid-c2/</id>
        
        <content type="html" xml:base="https://nbari.com/odroid-c2/">&lt;p&gt;Disabling blinking blue led:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;echo none &amp;gt; /sys/class/leds/blue:heartbeat/trigger&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To make the change permanent add the line to &lt;code&gt;/etc/rc.local&lt;/code&gt;&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>exec</title>
        <published>2018-05-14T11:46:01+02:00</published>
        <updated>2018-05-14T11:46:01+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/exec/"/>
        <id>https://nbari.com/exec/</id>
        
        <content type="html" xml:base="https://nbari.com/exec/">&lt;p&gt;&lt;strong&gt;exec&lt;/strong&gt; is a functionality of an operating system that runs an executable
file in the context of an already existing process, replacing the previous
executable. https://en.wikipedia.org/wiki/Exec_(system_call)&lt;/p&gt;
&lt;p&gt;&lt;code&gt;exec&lt;/code&gt; replaces the current program in the current process, without &lt;code&gt;fork&lt;/code&gt;ing a
new process.&lt;/p&gt;
&lt;p&gt;Examples to use:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;exec csh&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;This will just replace the existing shell with &lt;code&gt;csh&lt;/code&gt; and only need to type
&lt;code&gt;exit&lt;/code&gt; once&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Within a script to startup python scripts, for example:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;#!/bin/sh&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ENV_FOO=$(uname -a)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;exec gunicorn&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In this case the &lt;code&gt;exec&lt;/code&gt; tells sh to replace itself with &lt;code&gt;gunicorn&lt;/code&gt; this helps to
send signals directly to &lt;code&gt;gunicorn&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;When using &lt;code&gt;exec&lt;/code&gt; if command is not specified, any redirections take effect in the current shell:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;#!/bin/sh&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;exec 2&amp;gt;&amp;amp;1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;command&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If then calling the script:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ ./script 1&amp;gt; out 2&amp;gt; err&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;All the output will be combined in &lt;code&gt;out&lt;/code&gt;&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>sockstat</title>
        <published>2018-05-13T17:32:02+02:00</published>
        <updated>2018-05-13T17:32:02+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/sockstat/"/>
        <id>https://nbari.com/sockstat/</id>
        
        <content type="html" xml:base="https://nbari.com/sockstat/">&lt;p&gt;The &lt;code&gt;sockstat&lt;/code&gt; command list open Internet or UNIX domain sockets.&lt;/p&gt;
&lt;p&gt;List open tcp in ipv4:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# sockstat -4l&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Show connectd sockets in port 443 and tcp:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# sockstat -P tcp -p 443 -c&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;List unix sockets:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# sockstat -u&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Ansible ad-hoc</title>
        <published>2018-05-09T10:24:04+02:00</published>
        <updated>2018-05-09T10:24:04+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/ansible-adhoc/"/>
        <id>https://nbari.com/ansible-adhoc/</id>
        
        <content type="html" xml:base="https://nbari.com/ansible-adhoc/">&lt;p&gt;To send a command to all the servers within a playbook:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ ansible all -a &amp;quot;service chronyd restart&amp;quot; -u devops --become&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;what-s-an-ad-hoc-command&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#what-s-an-ad-hoc-command&quot; aria-label=&quot;Anchor link for: what-s-an-ad-hoc-command&quot;&gt;🔗&lt;/a&gt;What’s an ad-hoc command?&lt;/h2&gt;
&lt;p&gt;An ad-hoc command is something that you might type in to do something really
quick, but don’t want to save for later.&lt;/p&gt;
&lt;p&gt;http://docs.ansible.com/ansible/latest/user_guide/intro_adhoc.html&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>freebsd-update</title>
        <published>2018-05-05T15:58:57+02:00</published>
        <updated>2018-05-05T15:58:57+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/freebsd-update/"/>
        <id>https://nbari.com/freebsd-update/</id>
        
        <content type="html" xml:base="https://nbari.com/freebsd-update/">&lt;p&gt;Update Freebsd using &lt;code&gt;freebsd-update&lt;/code&gt;:&lt;/p&gt;
&lt;p&gt;Set in &lt;code&gt;/etc/rc.conf&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;kern_securelevel_enable=&amp;quot;NO&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;kern_securelevel=&amp;quot;0&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;reboot and then:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# freebsd-update upgrade -r 10.4-RELEASE&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# freebsd-update install&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# reboot&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# freebsd-update install&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;Repeate then to upgrade to 11.1 &lt;code&gt;freebsd-update upgrade -r 11.1-RELEASE&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Only security patches:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# freebsd-update fetch&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# freebsd-update install&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To update the packages:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# pkg-static upgrade -f&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# freebsd-update install&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;A forced upgrade of all installed packages will replace the packages with fresh versions from the repository even if the version number has not increased. This is required because of the ABI version change when upgrading between major versions of FreeBSD. The forced upgrade can be accomplished by performing:&lt;/p&gt;
&lt;/blockquote&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Influxdb</title>
        <published>2018-05-05T10:55:00+02:00</published>
        <updated>2018-05-05T10:55:00+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/influxdb/"/>
        <id>https://nbari.com/influxdb/</id>
        
        <content type="html" xml:base="https://nbari.com/influxdb/">&lt;p&gt;Basic influxdb queries, setup.&lt;/p&gt;
&lt;p&gt;You can use &lt;code&gt;influx&lt;/code&gt; (the influxdb shell) or use the http API on port &lt;code&gt;:8086&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Create and apply retention policy to a database: &lt;strong&gt;warning&lt;/strong&gt; this may remove/purge existing data&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;CREATE RETENTION POLICY &amp;quot;30_days&amp;quot; ON collectd DURATION 30d REPLICATION 1 default&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;notice the ending &lt;code&gt;default&lt;/code&gt; that means to apply the created policy&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;For 1 year, use &lt;code&gt;52w&lt;/code&gt; (52 weeks)&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;CREATE RETENTION POLICY &amp;quot;a_year&amp;quot; ON telegraf DURATION 52w REPLICATION 1 default&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Show retention policies:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;gt; show retention policies&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;name    duration shardGroupDuration replicaN default&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;----    -------- ------------------ -------- -------&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;autogen 0s       168h0m0s           1        false&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;30_days 720h0m0s 24h0m0s            1        true&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Show databases contents (measurements):&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;gt; show measurements on collectd&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;name: measurements&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;name&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;----&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cpu_value&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;df_value&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;disk_io_time&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;disk_read&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;disk_weighted_io_time&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;disk_write&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;filecount_value&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;interface_rx&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;interface_tx&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;load_longterm&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;load_midterm&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;load_shortterm&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;memory_value&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ntpd_value&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;processes_value&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap_value&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;tcpconns_value&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;uptime_value&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;users_value&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To see all series on a database:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;gt; show series on collectd limit 4&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;key&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cpu_value,host=aruba,instance=0,type=percent,type_instance=idle&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cpu_value,host=aruba,instance=0,type=percent,type_instance=interrupt&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cpu_value,host=aruba,instance=0,type=percent,type_instance=nice&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To get a specific serie:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;gt; show series on collectd from cpu_value WHERE host = &amp;#39;aruba&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;key&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cpu_value,host=aruba,instance=0,type=percent,type_instance=idle&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cpu_value,host=aruba,instance=0,type=percent,type_instance=interrupt&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cpu_value,host=aruba,instance=0,type=percent,type_instance=nice&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cpu_value,host=aruba,instance=0,type=percent,type_instance=system&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cpu_value,host=aruba,instance=0,type=percent,type_instance=user&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;loglevel-warn&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#loglevel-warn&quot; aria-label=&quot;Anchor link for: loglevel-warn&quot;&gt;🔗&lt;/a&gt;loglevel warn&lt;/h2&gt;
&lt;p&gt;To avoid multiple log lines like:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;error=&amp;quot;NaN is an unsupported value for field value&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Set the log level to &lt;code&gt;warn&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[logging]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  format = &amp;quot;auto&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  level = &amp;quot;info&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  suppress-logo = false&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;If you don&#39;t have this entry add it to your &lt;code&gt;influxd.conf&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h1 id=&quot;drop-series-not-getting-data&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#drop-series-not-getting-data&quot; aria-label=&quot;Anchor link for: drop-series-not-getting-data&quot;&gt;🔗&lt;/a&gt;Drop series not getting data&lt;/h1&gt;
&lt;p&gt;For example if using &lt;code&gt;collectd&lt;/code&gt; and want to remove series that haven&#39;t receive data in less than 10 days:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;#!/bin/sh&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;HOSTS=$(influx -database &amp;quot;collectd&amp;quot; -execute &amp;quot;SHOW TAG VALUES WITH KEY=host&amp;quot; | awk &amp;#39;/^host/ &amp;amp;&amp;amp; !a[$2]++ { print $2}&amp;#39;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;for i in ${HOSTS}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;do&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    PURGE=$(influx -database &amp;quot;collectd&amp;quot; -execute &amp;quot;SELECT last(value) FROM cpu_value WHERE host = &amp;#39;${i}&amp;#39; and time &amp;gt; now() -10d&amp;quot; | head -c1 | wc -c)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if [ ${PURGE} -eq 0 ]; then&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        echo &amp;quot;droping ${i}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        influx -database &amp;quot;collectd&amp;quot; -execute &amp;quot;DROP series WHERE host=&amp;#39;${i}&amp;#39;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    fi;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;done&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h1 id=&quot;time-format&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#time-format&quot; aria-label=&quot;Anchor link for: time-format&quot;&gt;🔗&lt;/a&gt;Time format&lt;/h1&gt;
&lt;p&gt;Within the CLI use:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;gt; precision rfc3339&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query using ssl:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ influx -ssl -unsafeSsl&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>womp</title>
        <published>2018-05-04T17:34:49+02:00</published>
        <updated>2018-05-04T17:34:49+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/womp/"/>
        <id>https://nbari.com/womp/</id>
        
        <content type="html" xml:base="https://nbari.com/womp/">&lt;p&gt;To enable &lt;a rel=&quot;external&quot; href=&quot;https://en.wikipedia.org/wiki/Wake-on-LAN&quot;&gt;WoL (Wake-on-LAN)&lt;/a&gt; on macOS:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ sudo pmset womp 1&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then check the settings:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ pmset -g&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;System-wide power settings:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Currently in use:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; standbydelay         10800&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; standby              1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; womp                 1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; halfdim              1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; hibernatefile        /var/vm/sleepimage&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; powernap             1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; gpuswitch            2&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; networkoversleep     0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; disksleep            10&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; sleep                1 (sleep prevented by coreaudiod, coreaudiod, iTunes)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; autopoweroffdelay    28800&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; hibernatemode        3&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; autopoweroff         1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; ttyskeepawake        1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; displaysleep         10&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; tcpkeepalive         1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; acwake               0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; lidwake              1&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Domain Fronting</title>
        <published>2018-05-02T12:42:22+02:00</published>
        <updated>2018-05-02T12:42:22+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/domain-fronting/"/>
        <id>https://nbari.com/domain-fronting/</id>
        
        <content type="html" xml:base="https://nbari.com/domain-fronting/">&lt;p&gt;If your domain becomes blocked you &quot;could use&quot; another one to bypass the block:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;curl -s -H &amp;quot;Host: your-blocked-domain&amp;quot; -H &amp;quot;Connection: close&amp;quot; &amp;quot;https://new-tld/your/path&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Both domains must be hosted within the same CDN, example:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;curl -s -H &amp;quot;Host: images-na.ssl-images-amazon.com&amp;quot; -H &amp;quot;Connection: close&amp;quot; &amp;quot;https://cdn.atlassian.com/images/I/01rgQ3jqo7L.css&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;More info:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;https://www.optiv.com/blog/escape-and-evasion-egressing-restricted-networks&lt;/li&gt;
&lt;li&gt;https://www.peew.pw/blog/2018/2/22/how-i-identified-93k-domain-frontable-cloudfront-domains&lt;/li&gt;
&lt;/ul&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>IDNA</title>
        <published>2018-04-29T13:35:43+02:00</published>
        <updated>2018-04-29T13:35:43+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/idna/"/>
        <id>https://nbari.com/idna/</id>
        
        <content type="html" xml:base="https://nbari.com/idna/">&lt;p&gt;To encode/decode a domain using &quot;Internationalized Domain Names&quot;&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ python&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;gt;&amp;gt;&amp;gt; x = u&amp;#39;qép.com&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;gt;&amp;gt;&amp;gt; x.encode(&amp;#39;idna&amp;#39;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;b&amp;#39;xn--qp-bja.com&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;gt;&amp;gt;&amp;gt; x.encode(&amp;#39;idna&amp;#39;).decode(&amp;#39;idna&amp;#39;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;#39;qép.com&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;gt;&amp;gt;&amp;gt; x == x.encode(&amp;#39;idna&amp;#39;).decode(&amp;#39;idna&amp;#39;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;True&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;To prevent non-international domain names containing hyphens from being accidentally interpreted as Punycode, international domain name Punycode sequences have a so-called ASCII Compatible Encoding (ACE) prefix, &quot;xn--&quot;, prepended.[2] Thus the domain name &quot;bücher.tld&quot; would be represented in ASCII as &quot;xn--bcher-kva.tld&quot;.&lt;/p&gt;
&lt;/blockquote&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Find Windows Product Key</title>
        <published>2018-04-26T15:45:05+02:00</published>
        <updated>2018-04-26T15:45:05+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/find-windows-product-key/"/>
        <id>https://nbari.com/find-windows-product-key/</id>
        
        <content type="html" xml:base="https://nbari.com/find-windows-product-key/">&lt;p&gt;To retrive the windows product key you can run this within a windows power
shell:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PS C:\Users\Monkey&amp;gt; (Get-WmiObject -query &amp;#39;select * from SoftwareLicensingService&amp;#39;).OA3xOriginalProductKey&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;xxxxx-xxxxx-xxxxx-xxxxx-xxxxx&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>parallel xargs</title>
        <published>2018-04-26T15:18:01+02:00</published>
        <updated>2018-04-26T15:18:01+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/parallel-xargs/"/>
        <id>https://nbari.com/parallel-xargs/</id>
        
        <content type="html" xml:base="https://nbari.com/parallel-xargs/">&lt;p&gt;To run a script in parallel using  &lt;code&gt;xargs&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;printf %d\\n {0..9} | xargs -n 1 -P8 sleep&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In this case sleep is going to be call 8 times &lt;code&gt;(-P8)&lt;/code&gt; using has the input an
int from 0 to 9.&lt;/p&gt;
&lt;p&gt;From the man:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-P maxprocs&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Parallel mode: run at most maxprocs invocations of utility at once.&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>tmp</title>
        <published>2018-04-24T18:20:47+02:00</published>
        <updated>2018-04-24T18:20:47+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/tmp/"/>
        <id>https://nbari.com/tmp/</id>
        
        <content type="html" xml:base="https://nbari.com/tmp/">&lt;p&gt;Ways to create a temp file:&lt;/p&gt;
&lt;p&gt;Using &lt;code&gt;mktemp&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ mktemp /tmp/file.XXX&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;The trailing &lt;code&gt;Xs&lt;/code&gt; will be replaced with the process number and/or a unique letter combination&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Creating a temp dir:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ mktemp -d /tmp/dir.XXX&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Output could be saved into a variable:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;TMPDIR=$(mktemp -d /tmp/dir.XXXX)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#&quot; aria-label=&quot;Anchor link for: &quot;&gt;🔗&lt;/a&gt;$$&lt;/h2&gt;
&lt;p&gt;Using &lt;code&gt;$$&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;OUT=/tmp/file.out.$$&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Here &lt;code&gt;$$&lt;/code&gt; will be replaced with the current process PID.&lt;/p&gt;
&lt;h2 id=&quot;random&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#random&quot; aria-label=&quot;Anchor link for: random&quot;&gt;🔗&lt;/a&gt;$RANDOM&lt;/h2&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;OUT=/tmp/file.out.${RANDOM}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;$RANDOM&lt;/code&gt; is an internal bash/zsh function (not a constant) that returns a pseudorandom [1] integer in the range 0 - 32767&lt;/p&gt;
&lt;/blockquote&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>pkg -o OSVERSION</title>
        <published>2018-04-21T20:38:04+02:00</published>
        <updated>2018-04-21T20:38:04+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/pkg-osversion/"/>
        <id>https://nbari.com/pkg-osversion/</id>
        
        <content type="html" xml:base="https://nbari.com/pkg-osversion/">&lt;p&gt;When updating if get something like this:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pkg: Newer FreeBSD version for package jsoncpp:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;- package: 1101503&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;- running kernel: 1100506&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Try &lt;code&gt;uname -KU&lt;/code&gt; to get the version, and then:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pkg -o OSVERSION=1100506 update -f&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pkg -o OSVERSION=1100506 upgrade&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Ansible Patterns</title>
        <published>2018-04-19T21:56:08+02:00</published>
        <updated>2018-04-19T21:56:08+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/ansible-patterns/"/>
        <id>https://nbari.com/ansible-patterns/</id>
        
        <content type="html" xml:base="https://nbari.com/ansible-patterns/">&lt;p&gt;To match hosts only starting with certain string a &lt;code&gt;regex&lt;/code&gt; could be used for example to match hosts starting with the word &lt;code&gt;fabrik&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;- hosts: ~fabrik.*&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  become: True&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  tasks:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    - name: uname&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      shell: uname -a&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      register: uname&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    - debug:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        var: uname.stdout&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;notice the &lt;code&gt;~&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>MTU 1453</title>
        <published>2018-04-10T21:16:59+02:00</published>
        <updated>2018-04-10T21:16:59+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/mtu-1453/"/>
        <id>https://nbari.com/mtu-1453/</id>
        
        <content type="html" xml:base="https://nbari.com/mtu-1453/">&lt;p&gt;If after upgrading macOS to &lt;code&gt;10.13.4&lt;/code&gt; wifi stop working give a try to change the &lt;code&gt;MTU&lt;/code&gt;:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/img/mtu-1453.png&quot; alt=&quot;mtu&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>radtest</title>
        <published>2018-03-26T14:23:55+02:00</published>
        <updated>2018-03-26T14:23:55+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/radtest/"/>
        <id>https://nbari.com/radtest/</id>
        
        <content type="html" xml:base="https://nbari.com/radtest/">&lt;p&gt;To test a radius server:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ brew install freeradius-server&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ radtest {username} {password} {hostname} 10 {radius_secret}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The &lt;code&gt;10&lt;/code&gt; is the &lt;code&gt;nas-port-number&lt;/code&gt;. Is an integer between &lt;code&gt;0&lt;/code&gt; and &lt;code&gt;2^31&lt;/code&gt;, and it really
doesn&#39;t matter what you put here.&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>git basics</title>
        <published>2018-03-25T19:45:41+02:00</published>
        <updated>2018-03-25T19:45:41+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/git/"/>
        <id>https://nbari.com/git/</id>
        
        <content type="html" xml:base="https://nbari.com/git/">&lt;h3 id=&quot;git-branch-a&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#git-branch-a&quot; aria-label=&quot;Anchor link for: git-branch-a&quot;&gt;🔗&lt;/a&gt;git branch -a&lt;/h3&gt;
&lt;p&gt;This will print all branches, local or remote, to see only local branches:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ git branch&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To only see remote branches:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ git branch -r&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;When you clone a repo after typing &lt;code&gt;git branch -a&lt;/code&gt; the output will look
something like this:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ git branch -a&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;* master&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  remotes/origin/HEAD -&amp;gt; origin/master&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  remotes/origin/master&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;master&lt;/code&gt; is a branch in the local repository, &lt;code&gt;remotes/origin/master&lt;/code&gt; is a branch named master on the remote named &lt;code&gt;origin&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;remotes/origin/master&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          |      |&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          |    name of branch&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   name of remote&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The branch can be referred as either &lt;code&gt;orign/master&lt;/code&gt; or &lt;code&gt;remotes/origin/master&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;remotes/origin/HEAD&lt;/code&gt; is the default branch for the remote named &lt;code&gt;origin&lt;/code&gt;&lt;/p&gt;
&lt;h2 id=&quot;clean-extra-files&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#clean-extra-files&quot; aria-label=&quot;Anchor link for: clean-extra-files&quot;&gt;🔗&lt;/a&gt;Clean extra files&lt;/h2&gt;
&lt;p&gt;For testing within your repository do this:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ touch foo{001..100}.tmp&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To remove all the files and untracked directories you can do:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ git clean -fd&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;search-for-commit-content&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#search-for-commit-content&quot; aria-label=&quot;Anchor link for: search-for-commit-content&quot;&gt;🔗&lt;/a&gt;Search for commit content&lt;/h2&gt;
&lt;p&gt;To search for commit content, actual lines of source:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ git grep &amp;lt;regexp&amp;gt; $(git rev-list --all)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;or in case you get &quot;Argument list too long&quot;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ git rev-list --all | xargs git grep expression&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;merge-squash-rebase&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#merge-squash-rebase&quot; aria-label=&quot;Anchor link for: merge-squash-rebase&quot;&gt;🔗&lt;/a&gt;merge, squash, rebase&lt;/h2&gt;
&lt;p&gt;So you are working on branch &lt;code&gt;master&lt;/code&gt; haven&#39;t add &amp;amp; commit your changes but
there has been an update on the origin/master, you would like to keep your
changes, update master to be in sync with the origin and later in in one single
commit once you are done working submit your changes.&lt;/p&gt;
&lt;p&gt;So if you are in &lt;code&gt;master&lt;/code&gt; branch:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ git fetch -p&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;The -p is for prune and clean unused branches&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Now save your changes by creating a new branch:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ git checkout -b my-changes&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Add and commit your changes:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ git add .&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;or&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ git commit -a -m &amp;quot;some changes&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To update master:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ git checkout master&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And then:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ git pull&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To continue working on your changes go back to your branch:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ git checkout my-changes&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You can work here commit etc, but once you are done if you would like to just
have 1 single commit, you can &lt;code&gt;squash&lt;/code&gt; your commits, for example to squash your
latest 6 commits, run this &lt;code&gt;git log --pretty=oneline --abbrev-commit&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; 1	    * 2018-03-28 dd34521 (HEAD -&amp;gt; my-changes) 5 &amp;lt;nbari&amp;gt; (1 second ago)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; 2	    * 2018-03-28 f31a830 4 &amp;lt;nbari&amp;gt; (8 seconds ago)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; 3	    * 2018-03-28 15a6af0 3 &amp;lt;nbari&amp;gt; (18 seconds ago)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; 4	    * 2018-03-28 9aaf8b3 2 &amp;lt;nbari&amp;gt; (24 seconds ago)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; 5	    * 2018-03-28 452b764 1 &amp;lt;nbari&amp;gt; (29 seconds ago)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; 6	    * 2018-03-28 447dae2 my changes for foo bar &amp;lt;nbari&amp;gt; (42 seconds ago)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      | * 2018-03-28 4dcbf9b (origin/master, origin/HEAD) --- remote origin master --- &amp;lt;nbari&amp;gt; (9 minutes ago)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      | * 2018-03-28 b8c35f4 Update date.txt &amp;lt;nbari&amp;gt; (37 minutes ago)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      | * 2018-03-28 fae7a75 udpate &amp;lt;nbari&amp;gt; (49 minutes ago)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      | * 2018-03-28 7ff5384 Update date.txt &amp;lt;nbari&amp;gt; (77 minutes ago)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      |/&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Create an alias &lt;code&gt;gl&lt;/code&gt; with this:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;git log --decorate --graph --oneline --all --date=short --pretty=format:&amp;#39;%C(bold blue)%ad%Creset %C(yellow)%h%Creset%C(auto)%d%Creset %s %C(dim magenta)&amp;lt;%an    &amp;gt;%Creset %C(dim green)(%ar)%Creset&amp;#39;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To squash the latest commits:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ git rebase -i HEAD~6&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This will open your editor probably with something like this:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pick 447dae2 my changes for foo bar&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;s 452b764 1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;s 9aaf8b3 2&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;s 15a6af0 3&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;s f31a830 4&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;s dd34521 5&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Rebase 5302aa0..dd34521 onto 5302aa0 (6 commands)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;#&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Commands:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# p, pick = use commit&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# r, reword = use commit, but edit the commit message&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# e, edit = use commit, but stop for amending&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# s, squash = use commit, but meld into previous commit&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# f, fixup = like &amp;quot;squash&amp;quot;, but discard this commit&amp;#39;s log message&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# x, exec = run command (the rest of the line) using shell&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# d, drop = remove commit&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Once you are done if you would like to merge (fast forward) you could rebase
your &lt;code&gt;my-changes&lt;/code&gt; branch with &lt;code&gt;master&lt;/code&gt;, so beeing in &lt;code&gt;my-changes&lt;/code&gt; branch, do:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ git rebase master&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If you have conflics fix them  &lt;code&gt;git rebase --continue&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Then to merge your changes on master:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ git checkout master&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And finally:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ git merge my-changes&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;git-pull-rebase&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#git-pull-rebase&quot; aria-label=&quot;Anchor link for: git-pull-rebase&quot;&gt;🔗&lt;/a&gt;git pull --rebase&lt;/h2&gt;
&lt;p&gt;In some cases you may not want to create a branch to keep your changes and just
would like to have the lates changes, so if some cases this can be achived by
doing:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ git  pull --rebase&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;reset-local-repository-branch-to-be-just-like-remote-repository&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#reset-local-repository-branch-to-be-just-like-remote-repository&quot; aria-label=&quot;Anchor link for: reset-local-repository-branch-to-be-just-like-remote-repository&quot;&gt;🔗&lt;/a&gt;reset local repository branch to be just like remote repository&lt;/h2&gt;
&lt;p&gt;In case you want have the repositories in sync:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ git fetch origin&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ git reset --hard origin/master&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You can do the same for a local branch:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ git reset --hard master&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Set fork to be the same as upstream:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;git remote add upstream https://github.com/some_user/some_repo&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;git fetch upstream&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;git checkout master&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;git reset --hard upstream/master&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;git push origin master --force&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Git Web Deployment Workflow</title>
        <published>2018-03-25T12:28:19+02:00</published>
        <updated>2018-03-25T12:28:19+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/git-web-deployment-workflow/"/>
        <id>https://nbari.com/git-web-deployment-workflow/</id>
        
        <content type="html" xml:base="https://nbari.com/git-web-deployment-workflow/">&lt;p&gt;The idea behind is to push to a remote repository on the same web/service server
and a &lt;code&gt;post-receive&lt;/code&gt; hook will checkout the files to the public directory.&lt;/p&gt;
&lt;h2 id=&quot;configuring-the-server&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#configuring-the-server&quot; aria-label=&quot;Anchor link for: configuring-the-server&quot;&gt;🔗&lt;/a&gt;Configuring the server&lt;/h2&gt;
&lt;p&gt;Create the repository:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ cd $HOME&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ mkdir my-site.git&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ cd my-site.git&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ git init --bare&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The idea of using &lt;code&gt;.git&lt;/code&gt; as a suffix is just to distinguish between other
directories.&lt;/p&gt;
&lt;p&gt;Crate the directory where you would like to deploy, for example:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ mkdir /home/sites/my-site&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&quot;create-a-post-receive-hook&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#create-a-post-receive-hook&quot; aria-label=&quot;Anchor link for: create-a-post-receive-hook&quot;&gt;🔗&lt;/a&gt;Create a post-receive hook&lt;/h3&gt;
&lt;p&gt;When you create a &lt;strong&gt;bare&lt;/strong&gt; repo, normally you get this structure:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; my-site.git&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;├── HEAD&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;├── config&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;├── description&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;├── hooks&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│   ├── applypatch-msg.sample&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│   ├── commit-msg.sample&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│   ├── fsmonitor-watchman.sample&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│   ├── post-update.sample&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│   ├── pre-applypatch.sample&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│   ├── pre-commit.sample&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│   ├── pre-push.sample&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│   ├── pre-rebase.sample&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│   ├── pre-receive.sample&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│   ├── prepare-commit-msg.sample&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│   └── update.sample&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;├── info&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│   └── exclude&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;├── objects&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│   ├── info&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│   └── pack&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;└── refs&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ├── heads&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    └── tags&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The &lt;code&gt;post-receive&lt;/code&gt; hook (located within the &lt;code&gt;hooks&lt;/code&gt; directory) will
be called after git has received commits, for example create the file
&lt;code&gt;$HOME/my-site.git/hooks/post-receive&lt;/code&gt; with this contents:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;#!/bin/sh&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;git --work-tree=/home/sites/my-site checkout -f&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Set &lt;code&gt;exec&lt;/code&gt; permissions to the hook:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;chmod +x hooks/post-receive&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;configure-your-local-machine&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#configure-your-local-machine&quot; aria-label=&quot;Anchor link for: configure-your-local-machine&quot;&gt;🔗&lt;/a&gt;Configure your local machine&lt;/h2&gt;
&lt;p&gt;Once you have setup your remote repository and the &lt;code&gt;post-receive&lt;/code&gt; hook, you
could add a second origin, something like:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ git remote add live ssh://username@your-host.tld/~/my-site.git&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Normally your project already has a remote named &quot;origin&quot; in where you can
continue pushing your changes, branches etc; this new remote named &lt;code&gt;live&lt;/code&gt; will
be only used to checkout/publish your changes after receiving a commit.&lt;/p&gt;
&lt;h2 id=&quot;deploy&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#deploy&quot; aria-label=&quot;Anchor link for: deploy&quot;&gt;🔗&lt;/a&gt;Deploy&lt;/h2&gt;
&lt;p&gt;Just need to push to your remote named &lt;strong&gt;live&lt;/strong&gt; in this example:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ git push live master&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;After doing this, you could check your remote server and check the contents of
&lt;code&gt;/home/sites/my-site&lt;/code&gt; it should be updated to your latest changes.&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>OBJC_DISABLE_INITIALIZE_FORK_SAFETY</title>
        <published>2018-03-22T15:28:13+01:00</published>
        <updated>2018-03-22T15:28:13+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/objc-disable-initialize-fork-safety/"/>
        <id>https://nbari.com/objc-disable-initialize-fork-safety/</id>
        
        <content type="html" xml:base="https://nbari.com/objc-disable-initialize-fork-safety/">&lt;p&gt;In macOS High Sierra if getting this:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;objc[55492]: +[__NSPlaceholderDate initialize] may have been in progress in another thread when fork() was called.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;objc[55492]: +[__NSPlaceholderDate initialize] may have been in progress in another thread when fork() was called. We cannot safely call it or ignore it in the fork() child process. Crashing instead. Set a breakpoint on objc_initializeAfterForkError to debug.&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Define:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This will fix temporally fix the problem and allow program to continue
executing, more about this issue here: http://sealiesoftware.com/blog/archive/2017/6/5/Objective-C_and_fork_in_macOS_1013.html&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>bash git prompt</title>
        <published>2018-03-20T22:28:21+01:00</published>
        <updated>2018-03-20T22:28:21+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/bash-git-prompt/"/>
        <id>https://nbari.com/bash-git-prompt/</id>
        
        <content type="html" xml:base="https://nbari.com/bash-git-prompt/">&lt;p&gt;To display the current branch in the terminal prompt using bash, add the
following lines to &lt;code&gt;~/.bash_profile&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;parse_git_branch() {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    git branch 2&amp;gt; /dev/null | sed -e &amp;#39;/^[^*]/d&amp;#39; -e &amp;#39;s/* \(.*\)/ (\1)/&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;export PS1=&amp;quot;\u@\h \[\033[32m\]\w\[\033[33m\]\$(parse_git_branch)\[\033[00m\] $ &amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>terms</title>
        <published>2018-03-18T22:10:55+01:00</published>
        <updated>2018-03-18T22:10:55+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/terms/"/>
        <id>https://nbari.com/terms/</id>
        
        <content type="html" xml:base="https://nbari.com/terms/">&lt;p&gt;Some common terms and definition&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;IT is full of buzzwords ...&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id=&quot;sre-site-reliability-engineering&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#sre-site-reliability-engineering&quot; aria-label=&quot;Anchor link for: sre-site-reliability-engineering&quot;&gt;🔗&lt;/a&gt;SRE -- Site Reliability Engineering&lt;/h2&gt;
&lt;p&gt;Site Reliability Engineering (SRE) is a discipline that incorporates aspects of
software engineering and applies that to IT operations problems. The main goals
are to create ultra-scalable and highly reliable software systems.&lt;/p&gt;
&lt;p&gt;A site reliability engineer (SRE) will spend up to 50% of their time doing &quot;ops&quot;
related work and spend the other 50% of their time on development&lt;/p&gt;
&lt;h2 id=&quot;devops&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#devops&quot; aria-label=&quot;Anchor link for: devops&quot;&gt;🔗&lt;/a&gt;DevOps&lt;/h2&gt;
&lt;p&gt;DevOps (development and operations) is a software development phrase used to
describe a type of agile relationship between Development and IT Operations. The
main characteristic of the DevOps movement is to strongly advocate automation
and monitoring at all steps of software construction, from integration, testing,
releasing to deployment and infrastructure management.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;DevOps isn&#39;t a job description/title, is a methodology.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id=&quot;provisioning&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#provisioning&quot; aria-label=&quot;Anchor link for: provisioning&quot;&gt;🔗&lt;/a&gt;Provisioning&lt;/h2&gt;
&lt;p&gt;Provisioning is the process of preparing new systems for users. The systems are
generally virtualized and instantiated on demand. Configuration of the machines
to install operating systems, middleware etc. is handled by automated system
configuration management tools, which also verify that the desired configuration is maintained.&lt;/p&gt;
&lt;h2 id=&quot;canary-release&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#canary-release&quot; aria-label=&quot;Anchor link for: canary-release&quot;&gt;🔗&lt;/a&gt;Canary Release&lt;/h2&gt;
&lt;p&gt;A go-live strategy in which a new application version is released to a small
subset of production servers and heavily monitored to determine whether it
behaves as expected. If everything seems stable, the new version is rolled out
to the entire production environment.&lt;/p&gt;
&lt;h2 id=&quot;configuration-management&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#configuration-management&quot; aria-label=&quot;Anchor link for: configuration-management&quot;&gt;🔗&lt;/a&gt;Configuration Management&lt;/h2&gt;
&lt;p&gt;A term for establishing and maintaining consistent settings and functional
attributes for a system. It includes tools for system administration tasks such
as IT infrastructure automation. (ansible/salt)&lt;/p&gt;
&lt;h2 id=&quot;orchestrator&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#orchestrator&quot; aria-label=&quot;Anchor link for: orchestrator&quot;&gt;🔗&lt;/a&gt;Orchestrator&lt;/h2&gt;
&lt;p&gt;A tool to provision, deploy, manage network, check security groups, create
VM&#39;s that in some cases can do the whole in an automated way based on defined
conditions. (saltstack)&lt;/p&gt;
&lt;h2 id=&quot;iac-infrastructure-as-code&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#iac-infrastructure-as-code&quot; aria-label=&quot;Anchor link for: iac-infrastructure-as-code&quot;&gt;🔗&lt;/a&gt;IaC -- Infrastructure as code&lt;/h2&gt;
&lt;p&gt;The process of managing and provisioning computer data centers through
machine-readable definition files, rather than physical hardware configuration
or interactive configuration tools. (terraform)&lt;/p&gt;
&lt;h2 id=&quot;osi-model-open-systems-interconnection&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#osi-model-open-systems-interconnection&quot; aria-label=&quot;Anchor link for: osi-model-open-systems-interconnection&quot;&gt;🔗&lt;/a&gt;OSI model (Open Systems Interconnection)&lt;/h2&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; 7. Application   --- (your app)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; 6. Presentation&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; 5. Session&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; 4. Transport     --- (TCP/UDP)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; 3. Network&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; 2. Data link&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; 1. Physical layer&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;https://nbari.com/post/osi/&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Linux Mac Address</title>
        <published>2018-03-14T14:51:38+01:00</published>
        <updated>2018-03-14T14:51:38+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/linux-mac-address/"/>
        <id>https://nbari.com/linux-mac-address/</id>
        
        <content type="html" xml:base="https://nbari.com/linux-mac-address/">&lt;p&gt;To get the &lt;a rel=&quot;external&quot; href=&quot;https://en.wikipedia.org/wiki/MAC_address&quot;&gt;MAC address&lt;/a&gt; from an
interface in linux:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cat /sys/class/net/eth1/address&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>ssh permissions are too open</title>
        <published>2018-03-12T20:41:19+01:00</published>
        <updated>2018-03-12T20:41:19+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/ssh-permissions-are-too-open/"/>
        <id>https://nbari.com/ssh-permissions-are-too-open/</id>
        
        <content type="html" xml:base="https://nbari.com/ssh-permissions-are-too-open/">&lt;p&gt;To set mode &lt;code&gt;0400&lt;/code&gt; to all your ssh keys:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ find ~/.ssh/* -type f -name &amp;quot;id*&amp;quot; -not -iname &amp;quot;*.pub&amp;quot; -exec chmod 0400 {} \+&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>nohup - disown</title>
        <published>2018-03-10T16:07:46+01:00</published>
        <updated>2018-03-10T16:07:46+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/nohup-disown/"/>
        <id>https://nbari.com/nohup-disown/</id>
        
        <content type="html" xml:base="https://nbari.com/nohup-disown/">&lt;p&gt;In case you don&#39;t have screen/tmux and need to run a process that won&#39;t be
terminated after closing the terminal:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ nohup your command &amp;amp;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ exit&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Or&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ your command &amp;amp;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ disown&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ exit&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If you have multiple commands:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ sleep 3600 &amp;amp;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ sleep 86400 &amp;amp;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;By typing &lt;code&gt;jobs&lt;/code&gt; something like this appears:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[1]  - running    sleep 3600&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[2]  + running    sleep 86400&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To &lt;code&gt;disown&lt;/code&gt; let&#39;s say only job 2:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ disown %2&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h1 id=&quot;process-already-running&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#process-already-running&quot; aria-label=&quot;Anchor link for: process-already-running&quot;&gt;🔗&lt;/a&gt;process already running&lt;/h1&gt;
&lt;p&gt;You can pause it &lt;code&gt;ctrl+z&lt;/code&gt;,  something like this will appear:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ sleep 3600&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;^Z&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;zsh: suspended  sleep 3600&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then type &lt;code&gt;bg&lt;/code&gt; to put it in background:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ bg&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[1]  + continued  sleep 3600&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;After that you can disown and exit:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ disown&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ exit&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>wait_for_connection</title>
        <published>2018-03-07T20:46:56+01:00</published>
        <updated>2018-03-07T20:46:56+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/wait-for-connection/"/>
        <id>https://nbari.com/wait-for-connection/</id>
        
        <content type="html" xml:base="https://nbari.com/wait-for-connection/">&lt;p&gt;Reboot and wait until server is reachable/usable:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;- name: Something that may reboot&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  shell: echo &amp;quot;true&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  register: should_reboot&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;- name: Rebooting ...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  shell: sleep 2 &amp;amp;&amp;amp; /sbin/shutdown -r now &amp;quot;Reboot required&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  async: 1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  poll: 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ignore_errors: true&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  register: rebooting&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  when: should_reboot.stdout == &amp;quot;true&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;- name: Wait for rebooted servers to come back&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  wait_for_connection:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    connect_timeout: 20&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sleep: 5&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    delay: 5&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    timeout: 60&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  when: rebooting|changed&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;For checking/testing if a remote host/service is up:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;- name: Wait for service to be ready&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  wait_for:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    port: 8080&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    host: 127.0.0.1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    connect_timeout: 3&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    delay: 3&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    timeout: 30&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Linux version</title>
        <published>2018-03-02T10:20:22+01:00</published>
        <updated>2018-03-02T10:20:22+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/linux-version/"/>
        <id>https://nbari.com/linux-version/</id>
        
        <content type="html" xml:base="https://nbari.com/linux-version/">&lt;p&gt;To determine what linux version you are using:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cat /etc/*elease&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Delete Guest</title>
        <published>2018-02-28T09:53:50+01:00</published>
        <updated>2018-02-28T09:53:50+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/delete-guest/"/>
        <id>https://nbari.com/delete-guest/</id>
        
        <content type="html" xml:base="https://nbari.com/delete-guest/">&lt;p&gt;To delete macOS Guest user:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sudo dscl . -delete /Users/Guest&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This will avoid showing the Guest user on the login screen&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>gpg</title>
        <published>2018-02-27T12:33:49+01:00</published>
        <updated>2018-02-27T12:33:49+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/gpg/"/>
        <id>https://nbari.com/gpg/</id>
        
        <content type="html" xml:base="https://nbari.com/gpg/">&lt;p&gt;Install gpg on macOS:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;brew install gnupg pinentry-mac&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;if required restart gpg-agent with &lt;code&gt;gpgconf --kill gpg-agent&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;To create a &lt;code&gt;gpg&lt;/code&gt; key in batch mode, create a file named &lt;code&gt;gpg-key-script&lt;/code&gt; with
this value:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Key-Type: EDDSA&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Key-Curve: Ed25519&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Key-Usage: sign auth&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Subkey-Type: ECDH&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Subkey-Curve: Cv25519&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Subkey-Usage: encrypt&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Name-Real: your name&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Name-Comment: your comment&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Name-Email: your@email&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Expire-Date: 2y&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Next you could do something like:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ gpg --homedir /salt/gpgkeys --batch --gen-key gen-key-script&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To extend the expiration date of a key:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ gpg --homedir /salt/gpgkeys --edit-key your@email&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gpg&amp;gt; expire&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Please specify how long the key should be valid.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        0 = key does not expire&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     &amp;lt;n&amp;gt;  = key expires in n days&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     &amp;lt;n&amp;gt;w = key expires in n weeks&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     &amp;lt;n&amp;gt;m = key expires in n months&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     &amp;lt;n&amp;gt;y = key expires in n years&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;For example to extend 1 year:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Your selection? 1y&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gpg&amp;gt; save&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;backup-private-key&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#backup-private-key&quot; aria-label=&quot;Anchor link for: backup-private-key&quot;&gt;🔗&lt;/a&gt;Backup private key&lt;/h2&gt;
&lt;p&gt;To save the private key to a file:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gpg --homedir /salt/gpgkeys -a --export-secret-keys &amp;gt; private.key&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;No need to export the public key&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;To import the pair of keys later just do:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gpg --import private.key&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;if can&#39;t paste the pssphrase:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;printf&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;#39;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;%s&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; password&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; |&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt; gpg&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; --batch --yes --pinentry-mode loopback --passphrase-fd&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 0&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; --import key&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h1 id=&quot;rngd-linux&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#rngd-linux&quot; aria-label=&quot;Anchor link for: rngd-linux&quot;&gt;🔗&lt;/a&gt;rngd (linux)&lt;/h1&gt;
&lt;p&gt;If you don&#39;t have an source of entropy it may take a while to generate the keys,
if you are in a linux system you could install &lt;code&gt;rngd&lt;/code&gt; or (&lt;code&gt;rng-tools&lt;/code&gt;) and then type:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# rngd -v&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Unable to open file: /dev/tpm0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;can&amp;#39;t open any entropy source&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Maybe RNG device modules are not loaded&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To start &lt;code&gt;rngd&lt;/code&gt; using &lt;code&gt;/dev/urandom&lt;/code&gt;, do this:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# cp /usr/lib/systemd/system/rngd.service /etc/systemd/system&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Edit &lt;code&gt;/etc/systemd/system/rngd.service&lt;/code&gt; and replace the line starting with &lt;code&gt;ExecStart&lt;/code&gt; with:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ExecStart=/sbin/rngd -f -r /dev/urandom&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Reload systemd:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# systemctl daemon-reload&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And restart &lt;code&gt;rngd&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# systemctl restart rngd&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h1 id=&quot;using-gpg-as-ssh&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#using-gpg-as-ssh&quot; aria-label=&quot;Anchor link for: using-gpg-as-ssh&quot;&gt;🔗&lt;/a&gt;using gpg as ssh&lt;/h1&gt;
&lt;p&gt;You need to install &lt;code&gt;monkeysphere&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ brew install monkeysphere&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To remove password from a subkey &quot;authentication [A]&quot; and convert later to ssh id_rsa:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ gpg --export-secret-subkey F6C7D705867D430! | gpg --home /tmp/x --import&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ gpg --home /tmp/x --change-passphrase F6C7D705867D430!&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ gpg --home /tmp/x --export-secret-subkey F6C7D705867D430! | openpgp2ssh F6C7D705867D430  &amp;gt; /tmp/naked-id_rsa&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then to add password again to the key:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ ssh-keygen -f /tmp/naked-id_rsa -p&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>sasl_username</title>
        <published>2018-02-24T09:32:04+01:00</published>
        <updated>2018-02-24T09:32:04+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/sasl-username/"/>
        <id>https://nbari.com/sasl-username/</id>
        
        <content type="html" xml:base="https://nbari.com/sasl-username/">&lt;p&gt;Find users sending email:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;tail -F /var/log/all.log | grep -i sasl_username&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>ldap_auth_disable_tls_never_use_in_production</title>
        <published>2018-02-21T15:38:30+01:00</published>
        <updated>2018-02-21T15:38:30+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/ldap-auth-disable-tls-never-use-in-production/"/>
        <id>https://nbari.com/ldap-auth-disable-tls-never-use-in-production/</id>
        
        <content type="html" xml:base="https://nbari.com/ldap-auth-disable-tls-never-use-in-production/">&lt;p&gt;To use &lt;a rel=&quot;external&quot; href=&quot;https://en.wikipedia.org/wiki/System_Security_Services_Daemon&quot;&gt;sssd&lt;/a&gt;
disabling TLS ( sssd doesn&#39;t work without TLS but there is this undocumented
option you can use ):&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ldap_auth_disable_tls_never_use_in_production = true&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In case you get this error:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Attribute &amp;#39;ldap_auth_disable_tls_never_use_in_production&amp;#39; is not allowed in section&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Try running this:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;authconfig --enablemkhomedir --enablesssdauth --updateall&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The &lt;code&gt;enablemkhomedir&lt;/code&gt; is a plus&lt;/p&gt;
&lt;p&gt;If when running &lt;code&gt;authconfig&lt;/code&gt; your &lt;code&gt;/etc/sssd/sssd.conf&lt;/code&gt; gets overwritten, set to
no this options:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;USELDAP=no&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;USELDAPAUTH=no&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>SElinux</title>
        <published>2018-02-21T09:39:12+01:00</published>
        <updated>2018-02-21T09:39:12+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/selinux/"/>
        <id>https://nbari.com/selinux/</id>
        
        <content type="html" xml:base="https://nbari.com/selinux/">&lt;p&gt;To disable SElinux temporaly:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;setenforce 0&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To disable SELinux Permanetly, edit file &lt;code&gt;/etc/sysconfig/selinux&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;# This file controls the state of SELinux on the system.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;# SELINUX= can take one of these three values:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;#     enforcing - SELinux security policy is enforced.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;#     permissive - SELinux prints warnings instead of enforcing.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;#     disabled - No SELinux policy is loaded.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SELINUX&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;enforcing&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;# SELINUXTYPE= can take one of three two values:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;#     targeted - Targeted processes are protected,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;#     minimum - Modification of targeted policy. Only selected processes are protected.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;#     mls - Multi Level Security protection.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SELINUXTYPE&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;targeted&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Change &lt;code&gt;SELINUX=enforcing&lt;/code&gt; to &lt;code&gt;SELINUX=disabled&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Check the status of SELinux using &lt;code&gt;sestatus&lt;/code&gt; command&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>UseKeychain</title>
        <published>2018-02-13T10:01:54+01:00</published>
        <updated>2018-02-13T10:01:54+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/usekeychain/"/>
        <id>https://nbari.com/usekeychain/</id>
        
        <content type="html" xml:base="https://nbari.com/usekeychain/">&lt;p&gt;To save SSH keys in macOS Sierra keychain add this to &lt;code&gt;~/.ssh/config&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Host *&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    AddKeysToAgent yes&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    UseKeychain yes&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;keychain-changes&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#keychain-changes&quot; aria-label=&quot;Anchor link for: keychain-changes&quot;&gt;🔗&lt;/a&gt;Keychain changes&lt;/h2&gt;
&lt;p&gt;Prior to macOS Sierra, ssh would present a dialog asking for your passphrase and
would offer the option to store it into the keychain. This UI was deprecated
some time ago and has been removed.&lt;/p&gt;
&lt;p&gt;Instead, a new UseKeychain option was introduced in macOS Sierra allowing users
to specify whether they would like for the passphrase to be stored in the
keychain. This option was enabled by default on macOS Sierra, which caused all
passphrases to be stored in the keychain.&lt;/p&gt;
&lt;p&gt;This was not the intended default behavior, so this has been changed in macOS
10.12.2. To store passphrases in the keychain, set this option in your ssh
configuration file:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;UseKeychain yes&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;https://developer.apple.com/library/content/technotes/tn2449/_index.html&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Find and replace recursive</title>
        <published>2018-01-17T10:08:38+01:00</published>
        <updated>2018-01-17T10:08:38+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/find-and-replace-recursive/"/>
        <id>https://nbari.com/find-and-replace-recursive/</id>
        
        <content type="html" xml:base="https://nbari.com/find-and-replace-recursive/">&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Do not run this command on a folder including a git repo - changes to
.git could corrupt your get index.&lt;/p&gt;
&lt;p&gt;For example to replace an IP on multiple files:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;find /tmp/path -type f -exec sed -i &amp;#39;&amp;#39; &amp;#39;s/193.111.141.1/82.14.220.137/g&amp;#39; {} +&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Multiple AMI&#39;s&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;find . -type f -name &amp;quot;variables.tf&amp;quot; -exec sed -i &amp;#39;s/ami-0e4168a4236171887/ami-00bec4c01ec9355e2/g&amp;#39; {} +&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;On BSD, MAC by passing an empty string to sed&#39;s -i args will create no backup&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id=&quot;perl-pi-e&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#perl-pi-e&quot; aria-label=&quot;Anchor link for: perl-pi-e&quot;&gt;🔗&lt;/a&gt;perl -pi -e&lt;/h2&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;perl -pi -e &amp;#39;s/replace_this/with_this/&amp;#39; files-*&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This is useful when you don&#39;t want to change the file ending like in &lt;code&gt;sed&lt;/code&gt; that
adds an &lt;code&gt;\n&lt;/code&gt; ad the end of the file&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>ciphers supported</title>
        <published>2018-01-08T11:38:18+01:00</published>
        <updated>2018-01-08T11:38:18+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/ciphers-supported/"/>
        <id>https://nbari.com/ciphers-supported/</id>
        
        <content type="html" xml:base="https://nbari.com/ciphers-supported/">&lt;p&gt;List ciphers supported by an HTTP server:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;nmap --script ssl-enum-ciphers -p 443 www.nbari.com&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Example of output:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;PORT&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;    STATE SERVICE&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;443/tcp&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; open  https&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt; ssl-enum-ciphers:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;   TLSv1.1:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;     ciphers:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;       TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA&lt;/span&gt;&lt;span&gt; (secp256r1) - A&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;       TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA&lt;/span&gt;&lt;span&gt; (secp256r1) - A&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;       TLS_RSA_WITH_AES_256_CBC_SHA&lt;/span&gt;&lt;span&gt; (rsa&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 2048&lt;/span&gt;&lt;span&gt;) - A&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;       TLS_RSA_WITH_AES_128_CBC_SHA&lt;/span&gt;&lt;span&gt; (rsa&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 2048&lt;/span&gt;&lt;span&gt;) - A&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;     compressors:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;       NULL&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;     cipher&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; preference: server&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;   TLSv1.2:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;     ciphers:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;       TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256&lt;/span&gt;&lt;span&gt; (secp256r1) - A&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;       TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256&lt;/span&gt;&lt;span&gt; (secp256r1) - A&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;       TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA&lt;/span&gt;&lt;span&gt; (secp256r1) - A&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;       TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384&lt;/span&gt;&lt;span&gt; (secp256r1) - A&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;       TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384&lt;/span&gt;&lt;span&gt; (secp256r1) - A&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;       TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA&lt;/span&gt;&lt;span&gt; (secp256r1) - A&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;       TLS_RSA_WITH_AES_128_GCM_SHA256&lt;/span&gt;&lt;span&gt; (rsa&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 2048&lt;/span&gt;&lt;span&gt;) - A&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;       TLS_RSA_WITH_AES_256_GCM_SHA384&lt;/span&gt;&lt;span&gt; (rsa&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 2048&lt;/span&gt;&lt;span&gt;) - A&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;       TLS_RSA_WITH_AES_128_CBC_SHA256&lt;/span&gt;&lt;span&gt; (rsa&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 2048&lt;/span&gt;&lt;span&gt;) - A&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;       TLS_RSA_WITH_AES_256_CBC_SHA&lt;/span&gt;&lt;span&gt; (rsa&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 2048&lt;/span&gt;&lt;span&gt;) - A&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;       TLS_RSA_WITH_AES_128_CBC_SHA&lt;/span&gt;&lt;span&gt; (rsa&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 2048&lt;/span&gt;&lt;span&gt;) - A&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;     compressors:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;       NULL&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;     cipher&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; preference: server&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;_&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;  least strength: A&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;Nmap&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; done:&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 1&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; IP address&lt;/span&gt;&lt;span&gt; (1&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; host up&lt;/span&gt;&lt;span&gt;) scanned in 9.18 seconds&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Also check &lt;code&gt;sslscan&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;brew install sslscan&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>attachments from console</title>
        <published>2018-01-03T10:50:58+01:00</published>
        <updated>2018-01-03T10:50:58+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/attachments-from-console/"/>
        <id>https://nbari.com/attachments-from-console/</id>
        
        <content type="html" xml:base="https://nbari.com/attachments-from-console/">&lt;p&gt;To send attachments within the terminal/console:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; $ uuencode file.bz2 attach-name.bz2 | mail -s &amp;quot;attachment&amp;quot; foo@bar.com&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>update port</title>
        <published>2017-12-30T11:25:34+01:00</published>
        <updated>2017-12-30T11:25:34+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/update-port/"/>
        <id>https://nbari.com/update-port/</id>
        
        <content type="html" xml:base="https://nbari.com/update-port/">&lt;p&gt;Make a copy of the current port:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cp -R &amp;lt;port-name&amp;gt; &amp;lt;port-name&amp;gt;.orig&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Or create a branch:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;git checkout -b &amp;lt;port-name&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Update the Makefile, then run:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;make makesum&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;make checksum&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Update crates if required by using:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;make cargo-crates&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Work on the port:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;make makesum&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;make checksum&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;make stage&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;make check-orphans&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;make package&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;make install&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;make deinstall&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;make clean&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Crete the diff, first change one level up:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;diff -u port-name.orig port-name &amp;gt; port-name.diff&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Or if you are using git:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;git commit&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;git format-patch main&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Submit the patch.&lt;/p&gt;
&lt;h2 id=&quot;poudriere&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#poudriere&quot; aria-label=&quot;Anchor link for: poudriere&quot;&gt;🔗&lt;/a&gt;poudriere&lt;/h2&gt;
&lt;p&gt;Test port with poudriere, for example:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;poudriere testport -p default -j 14amd64 net/s3m&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>raidz2</title>
        <published>2017-12-28T22:20:37+01:00</published>
        <updated>2017-12-28T22:20:37+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/raidz2/"/>
        <id>https://nbari.com/raidz2/</id>
        
        <content type="html" xml:base="https://nbari.com/raidz2/">&lt;p&gt;If using a DELL PERL 6/i Integrated, configure each disk as RAID-0:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span&gt; mfiutil show config&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;mfi0&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; Configuration:&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 8&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; arrays,&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 8&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; volumes,&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 1&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; spares&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;    array&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 0&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; of&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 2&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; drives:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;        drive&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;  1&lt;/span&gt;&lt;span&gt; (&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; 1863G&lt;/span&gt;&lt;span&gt;) ONLINE &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;ST2000DM006-2DM1 CC26 serial&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;Z4Z8BX6V&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt; SATA&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;        drive&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;  6&lt;/span&gt;&lt;span&gt; (&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; 1863G&lt;/span&gt;&lt;span&gt;) ONLINE &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;ST2000DM006-2DM1 CC26 serial&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;Z4Z8BY35&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt; SATA&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;    array&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 1&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; of&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 1&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; drives:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;        drive&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;  0&lt;/span&gt;&lt;span&gt; (&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;  466G&lt;/span&gt;&lt;span&gt;) ONLINE &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;SEAGATE ST500NM0001 PS07 serial&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;Z1M17ZJ0&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt; SCSI-6&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;    array&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 2&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; of&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 1&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; drives:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;        drive&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;  2&lt;/span&gt;&lt;span&gt; (&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;  466G&lt;/span&gt;&lt;span&gt;) ONLINE &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;SEAGATE ST500NM0001 0002 serial&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;Z1M0DAVE&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt; SCSI-6&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;    array&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 3&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; of&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 1&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; drives:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;        drive&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;  3&lt;/span&gt;&lt;span&gt; (&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;  932G&lt;/span&gt;&lt;span&gt;) ONLINE &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;SEAGATE ST1000NM0023 0004 serial&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;Z1W54HJV&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt; SCSI-6&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;    array&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 4&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; of&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 1&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; drives:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;        drive&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;  4&lt;/span&gt;&lt;span&gt; (&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;  466G&lt;/span&gt;&lt;span&gt;) ONLINE &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;SEAGATE ST3500620SS MS04 serial&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;9QM5L94N&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt; SAS&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;    array&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 5&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; of&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 1&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; drives:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;        drive&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;  5&lt;/span&gt;&lt;span&gt; (&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;  466G&lt;/span&gt;&lt;span&gt;) ONLINE &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;SEAGATE ST3500620SS MS04 serial&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;9QM5L9C4&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt; SAS&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;    array&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 6&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; of&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 1&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; drives:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;        drive&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;  8&lt;/span&gt;&lt;span&gt; (&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;  466G&lt;/span&gt;&lt;span&gt;) ONLINE &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;SEAGATE ST3500620SS MS04 serial&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;9QM5L8DD&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt; SAS&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;    array&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 7&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; of&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 1&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; drives:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;        drive&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;  9&lt;/span&gt;&lt;span&gt; (&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;  466G&lt;/span&gt;&lt;span&gt;) ONLINE &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;SEAGATE ST3500620SS MS04 serial&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;9QM5L824&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt; SAS&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;    volume&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; mfid0&lt;/span&gt;&lt;span&gt; (1863G) RAID-1 64K OPTIMAL &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;raid&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;1&amp;gt;&lt;/span&gt;&lt;span&gt; spans:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;        array&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;    volume&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; mfid1&lt;/span&gt;&lt;span&gt; (465G) RAID-0 64K OPTIMAL &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;r&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;0&amp;gt;&lt;/span&gt;&lt;span&gt; spans:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;        array&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;    volume&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; mfid2&lt;/span&gt;&lt;span&gt; (465G) RAID-0 64K OPTIMAL &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;r&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;2&amp;gt;&lt;/span&gt;&lt;span&gt; spans:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;        array&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 2&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;    volume&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; mfid3&lt;/span&gt;&lt;span&gt; (931G) RAID-0 64K OPTIMAL &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;r&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;3&amp;gt;&lt;/span&gt;&lt;span&gt; spans:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;        array&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 3&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;    volume&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; mfid4&lt;/span&gt;&lt;span&gt; (465G) RAID-0 64K OPTIMAL &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;r&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;4&amp;gt;&lt;/span&gt;&lt;span&gt; spans:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;        array&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 4&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;    volume&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; mfid5&lt;/span&gt;&lt;span&gt; (465G) RAID-0 64K OPTIMAL &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;r&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;5&amp;gt;&lt;/span&gt;&lt;span&gt; spans:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;        array&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 5&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;    volume&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; mfid6&lt;/span&gt;&lt;span&gt; (465G) RAID-0 64K OPTIMAL &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;r&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;8&amp;gt;&lt;/span&gt;&lt;span&gt; spans:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;        array&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 6&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;    volume&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; mfid7&lt;/span&gt;&lt;span&gt; (465G) RAID-0 64K OPTIMAL &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;r&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;9&amp;gt;&lt;/span&gt;&lt;span&gt; spans:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;        array&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 7&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;    dedicated&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; spare&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;  7&lt;/span&gt;&lt;span&gt; (&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; 1863G&lt;/span&gt;&lt;span&gt;) HOT SPARE &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;ST2000DM006-2DM1 CC26 serial&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;Z4Z8BPTG&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt; SATA&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; backs:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;        array&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Array has one RAID-1 using 3 disks and the others are disk are each one a RAID-0 volume&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span&gt; mfiutil show volumes&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;mfi0&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; Volumes:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;  Id&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;     Size    Level   Stripe  State   Cache   Name&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt; mfid0&lt;/span&gt;&lt;span&gt; (&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; 1863G&lt;/span&gt;&lt;span&gt;) RAID-1      64K OPTIMAL Disabled &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;raid&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;1&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt; mfid1&lt;/span&gt;&lt;span&gt; (&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;  465G&lt;/span&gt;&lt;span&gt;) RAID-0      64K OPTIMAL Disabled &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;r&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;0&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt; mfid2&lt;/span&gt;&lt;span&gt; (&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;  465G&lt;/span&gt;&lt;span&gt;) RAID-0      64K OPTIMAL Disabled &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;r&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;2&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt; mfid3&lt;/span&gt;&lt;span&gt; (&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;  931G&lt;/span&gt;&lt;span&gt;) RAID-0      64K OPTIMAL Disabled &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;r&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;3&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt; mfid4&lt;/span&gt;&lt;span&gt; (&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;  465G&lt;/span&gt;&lt;span&gt;) RAID-0      64K OPTIMAL Disabled &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;r&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;4&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt; mfid5&lt;/span&gt;&lt;span&gt; (&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;  465G&lt;/span&gt;&lt;span&gt;) RAID-0      64K OPTIMAL Disabled &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;r&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;5&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt; mfid6&lt;/span&gt;&lt;span&gt; (&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;  465G&lt;/span&gt;&lt;span&gt;) RAID-0      64K OPTIMAL Disabled &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;r&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;8&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt; mfid7&lt;/span&gt;&lt;span&gt; (&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;  465G&lt;/span&gt;&lt;span&gt;) RAID-0      64K OPTIMAL Disabled &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;r&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;9&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To configure the raid:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;zpool create -f &amp;lt;pool-name&amp;gt; raidz2 mfid1 mfid2 mfid3 mfid4 mfid5 mfid6&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Add a spare:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;zpool add  &amp;lt;pool-name&amp;gt; spare mfid7&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This is the output of &lt;code&gt;zpool status&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span&gt; zpool status&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;  pool:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; sas&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt; state:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; ONLINE&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;  scan:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; none requested&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;config:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;        NAME&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;        STATE&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;        sas&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;         ONLINE&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;          raidz2-0&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;  ONLINE&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;            mfid1&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;   ONLINE&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;            mfid2&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;   ONLINE&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;            mfid3&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;   ONLINE&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;            mfid4&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;   ONLINE&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;            mfid5&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;   ONLINE&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;            mfid6&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;   ONLINE&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;        spares&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;          mfid7&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;     AVAIL&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;errors:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; No known data errors&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In this case the pool named &lt;code&gt;sas&lt;/code&gt; is a mix of SAS, SCSI of different sizes:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span&gt; mfiutil show drives&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;mfi0&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; Physical Drives:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt; 0&lt;/span&gt;&lt;span&gt; (&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;  466G&lt;/span&gt;&lt;span&gt;) ONLINE    &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;SEAGATE ST500NM0001 PS07 serial&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;Z1M17ZJ0&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt; SCSI-6&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; E1:S0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt; 1&lt;/span&gt;&lt;span&gt; (&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; 1863G&lt;/span&gt;&lt;span&gt;) ONLINE    &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;ST2000DM006-2DM1 CC26 serial&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;Z4Z8BX6V&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt; SATA&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; E1:S1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt; 2&lt;/span&gt;&lt;span&gt; (&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;  466G&lt;/span&gt;&lt;span&gt;) ONLINE    &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;SEAGATE ST500NM0001 0002 serial&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;Z1M0DAVE&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt; SCSI-6&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; E1:S2&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt; 3&lt;/span&gt;&lt;span&gt; (&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;  932G&lt;/span&gt;&lt;span&gt;) ONLINE    &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;SEAGATE ST1000NM0023 0004 serial&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;Z1W54HJV&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt; SCSI-6&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; E1:S3&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt; 4&lt;/span&gt;&lt;span&gt; (&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;  466G&lt;/span&gt;&lt;span&gt;) ONLINE    &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;SEAGATE ST3500620SS MS04 serial&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;9QM5L94N&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt; SAS&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; E1:S4&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt; 5&lt;/span&gt;&lt;span&gt; (&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;  466G&lt;/span&gt;&lt;span&gt;) ONLINE    &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;SEAGATE ST3500620SS MS04 serial&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;9QM5L9C4&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt; SAS&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; E1:S5&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt; 6&lt;/span&gt;&lt;span&gt; (&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; 1863G&lt;/span&gt;&lt;span&gt;) ONLINE    &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;ST2000DM006-2DM1 CC26 serial&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;Z4Z8BY35&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt; SATA&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; E1:S6&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt; 7&lt;/span&gt;&lt;span&gt; (&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; 1863G&lt;/span&gt;&lt;span&gt;) HOT SPARE &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;ST2000DM006-2DM1 CC26 serial&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;Z4Z8BPTG&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt; SATA&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; E1:S7&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt; 8&lt;/span&gt;&lt;span&gt; (&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;  466G&lt;/span&gt;&lt;span&gt;) ONLINE    &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;SEAGATE ST3500620SS MS04 serial&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;9QM5L8DD&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt; SAS&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; E1:S8&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt; 9&lt;/span&gt;&lt;span&gt; (&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;  466G&lt;/span&gt;&lt;span&gt;) ONLINE    &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;SEAGATE ST3500620SS MS04 serial&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;9QM5L824&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt; SAS&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; E1:S9&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Enable cache on all disks:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;i=0; while [ $i -le 9 ]; do mfiutil cache mfid${i} enable; i=`expr $i + 1`; done&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>DRAC5 Update</title>
        <published>2017-12-28T01:39:30+01:00</published>
        <updated>2017-12-28T01:39:30+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/drac5-update/"/>
        <id>https://nbari.com/drac5-update/</id>
        
        <content type="html" xml:base="https://nbari.com/drac5-update/">&lt;p&gt;Download the firmware: http://www.dell.com/support/home/de/de/debsdt1/Drivers/DriversDetails?driverId=F3FXW&lt;/p&gt;
&lt;p&gt;In mac you can unzip the exe:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;unzip f_drac5v160_A00.exe&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;On the DRAC web interface go to &quot;Remote Access&quot; and upload the file &lt;strong&gt;firmimg.d5&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;If getting errors like:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Unsigned application requesting unrestricted access to system. The following resource is signed with a weak signature algorithm MD5withRSA and is treated as unsigned.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;In windows file is in: &lt;code&gt;c:\Program Files\Java\jre7\lib\security\java.security&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;On mac os, edit this file: &lt;code&gt;/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/security/java.security&lt;/code&gt; and comment this lines:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# jdk.jar.disabledAlgorithms=MD2, MD5, RSA keySize &amp;lt; 1024&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This one is if while connecting you get an  Error when reading from SSL socket connection:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# jdk.tls.disabledAlgorithms=SSLv3, RC4, MD5withRSA, DH keySize &amp;lt; 768, \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# EC keySize &amp;lt; 224&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To load the &lt;strong&gt;Virtual Media&lt;/strong&gt; you may need a 32 bit version of java
(virtualbox/windows), and deleting the &lt;code&gt;java.security&lt;/code&gt; file works&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/img/drac-virtual-media.png&quot; alt=&quot;drac virtual media&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>ssh update Host Keys</title>
        <published>2017-12-26T16:19:15+01:00</published>
        <updated>2017-12-26T16:19:15+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/ssh-update-host-keys/"/>
        <id>https://nbari.com/ssh-update-host-keys/</id>
        
        <content type="html" xml:base="https://nbari.com/ssh-update-host-keys/">&lt;p&gt;To create new ssh keys on the server:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ssh-keygen -f /etc/ssh/ssh_host_rsa_key -N &amp;#39;&amp;#39; -t rsa&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ssh-keygen -f /etc/ssh/ssh_host_ecdsa_key -N &amp;#39;&amp;#39; -t ecdsa -b 521&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To check the fingerprint:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ssh-keygen -lf ssh_host_ecdsa_key&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;On the client side:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Someone could be eavesdropping on you right now (man-in-the-middle attack)!&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;It is also possible that a host key has just been changed.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;The fingerprint for the ECDSA key sent by the remote host is&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SHA256:kY/TymCiskD0nhhyWaovohYvfCyZ7ymrEsmujeawaww.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Please contact your system administrator.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Add correct host key in /Users/monkey/.ssh/known_hosts to get rid of this message.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Offending ECDSA key in /Users/monkey/.ssh/known_hosts:236&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ECDSA host key for [76.9.57.82]:2222 has changed and you have requested strict checking.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Host key verification failed.&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To see the key on line 236:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;awk &amp;#39;NR==236&amp;#39; know_hosts&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To remove the key:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ssh-keygen -R &amp;quot;[76.9.57.82]:2222&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Try to ssh again and veriy the key matches the one on the server.&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>mysql SHA512 CRYPT</title>
        <published>2017-12-23T10:41:29+01:00</published>
        <updated>2017-12-23T10:41:29+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/mysql-sha512-crypt/"/>
        <id>https://nbari.com/mysql-sha512-crypt/</id>
        
        <content type="html" xml:base="https://nbari.com/mysql-sha512-crypt/">&lt;p&gt;To create a password using the  &lt;code&gt;SHA512-CRYPT&lt;/code&gt; schema:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SELECT ENCRYPT(&amp;quot;password&amp;quot;, CONCAT(&amp;#39;$6$&amp;#39;,sha(RAND())));&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To create an user:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;INSERT INTO users SET password=ENCRYPT(&amp;quot;password&amp;quot;, CONCAT(&amp;#39;$6$&amp;#39;,sha(RAND())));&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To use with postfix or dovecot:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;INSERT INTO users SET password=CONCAT(&amp;#39;{SHA512-CRYPT}&amp;#39;, ENCRYPT(&amp;quot;password&amp;quot;, CONCAT(&amp;#39;$6$&amp;#39;,sha(RAND()))));&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>syslog-ng Ubuntu</title>
        <published>2017-12-15T11:25:12+01:00</published>
        <updated>2017-12-15T11:25:12+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/syslog-ng-ubuntu/"/>
        <id>https://nbari.com/syslog-ng-ubuntu/</id>
        
        <content type="html" xml:base="https://nbari.com/syslog-ng-ubuntu/">&lt;p&gt;Errors you may get:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Can&amp;#39;t find class; class_name=&amp;#39;org.syslog_ng.elasticsearch_v2.ElasticSearchDestination&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Working configuration:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;@version:3.13&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;@module mod-java&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;@include &amp;quot;scl.conf&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;options {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    flush_lines(0);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    keep_hostname(yes);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    normalize_hostnames(yes);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    threaded(yes);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;};&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;source      s_local   { system(); internal();   };&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;source      s_network { syslog(transport(tcp)); };&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;destination d_all { file (&amp;quot;/var/log/all.log&amp;quot;); };&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;destination d_elastic {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  elasticsearch2(&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    client-lib-dir(&amp;quot;/usr/lib/syslog-ng/3.13/java-modules/elastic-jest-client/*.jar:/usr/share/elasticsearch/lib/:/usr/lib/syslog-ng/3.13/java-modules/&amp;quot;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    client_mode(&amp;quot;http&amp;quot;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    cluster_url(&amp;quot;http://your-elasticsearch:9200&amp;quot;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    index(&amp;quot;syslog-ng_${YEAR}.${MONTH}.${DAY}&amp;quot;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    type(&amp;quot;syslog&amp;quot;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    cluster(&amp;quot;test&amp;quot;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    flush-limit(&amp;quot;1000&amp;quot;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    template(&amp;quot;$(format-json --scope rfc5424 --scope nv-pairs --exclude DATE --key ISODATE)&amp;quot;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    time-zone(&amp;quot;UTC&amp;quot;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  );&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;};&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;log { source(s_network); destination(d_elastic); };&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;log { source(s_local); destination(d_all); };&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Notice the &lt;code&gt;client-lib-dir&lt;/code&gt; line:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;client-lib-dir(&amp;quot;/usr/lib/syslog-ng/3.13/java-modules/elastic-jest-client/*.jar:/usr/share/elasticsearch/lib/:/usr/lib/syslog-ng/3.13/java-modules/&amp;quot;)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>80</title>
        <published>2017-12-11T19:09:58+01:00</published>
        <updated>2017-12-11T19:09:58+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/80/"/>
        <id>https://nbari.com/80/</id>
        
        <content type="html" xml:base="https://nbari.com/80/">&lt;p&gt;To start an application on port &lt;code&gt;80&lt;/code&gt; being not root:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sysctl net.inet.ip.portrange.reservedhigh=79&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;That will allow to bind an application in any port &amp;gt; 79, to allow any port:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sysctl net.inet.ip.portrange.reservedhigh=0&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Add this to &lt;code&gt;/etc/sysctl.conf&lt;/code&gt; to keep changes persistent across reboots:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;net.inet.ip.portrange.reservedhigh=79&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>ntpdate</title>
        <published>2017-12-11T10:56:33+01:00</published>
        <updated>2017-12-11T10:56:33+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/ntpdate/"/>
        <id>https://nbari.com/ntpdate/</id>
        
        <content type="html" xml:base="https://nbari.com/ntpdate/">&lt;p&gt;If you want to execute &lt;code&gt;ntpdate&lt;/code&gt; with the ntp daemon already up and running, use
the following command:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ntpdate -v -b -u 0.pool.ntp.org&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To only test an NTP server or responding to queries:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ntpdate -q time.google.com&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>nginx + lua + redis</title>
        <published>2017-12-06T17:15:19+01:00</published>
        <updated>2017-12-06T17:15:19+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/nginx-lua-redis/"/>
        <id>https://nbari.com/nginx-lua-redis/</id>
        
        <content type="html" xml:base="https://nbari.com/nginx-lua-redis/">&lt;p&gt;Basic &lt;a rel=&quot;external&quot; href=&quot;https://en.wikipedia.org/wiki/Web_application_firewall&quot;&gt;WAF&lt;/a&gt; example
using &lt;a rel=&quot;external&quot; href=&quot;https://www.lua.org/&quot;&gt;lua&lt;/a&gt; + &lt;a rel=&quot;external&quot; href=&quot;https://redis.io/&quot;&gt;redis&lt;/a&gt; within nginx.&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;--&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;--   lua_package_path &amp;quot;/usr/share/lua/5.1/nginx/?.lua;;&amp;quot;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;--   lua_shared_dict ip_blacklist 4m;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;--&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;local redis_host               = &amp;quot;your.redis.tld&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;local redis_port               = 6379&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;local redis_connection_timeout = 300&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;local redis_pattern            = &amp;quot;block-&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;local cache_ttl                = 3 -- seconds&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;local ip                       = ngx.var.remote_addr&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;local ip_blacklist             = ngx.shared.ip_blacklist&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;local last_update_time         = ip_blacklist:get(&amp;quot;last_update_time&amp;quot;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-- block if ip found in the local nginx dict&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;if ip_blacklist:get(ip) then&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ngx.log(ngx.DEBUG, &amp;quot;Banned IP detected and refused access: &amp;quot; .. ip);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return ngx.exit(429);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;end&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-- only update ip_blacklist from Redis once every cache_ttl seconds:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;if last_update_time == nil or last_update_time &amp;lt; ( ngx.now() - cache_ttl ) then&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    local redis = require &amp;quot;redis&amp;quot;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    local red = redis:new();&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    red:set_timeout(redis_connect_timeout);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    local ok, err = red:connect(redis_host, redis_port);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if not ok then&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ngx.log(ngx.DEBUG, &amp;quot;Redis connection error while retrieving ip_blacklist: &amp;quot; .. err);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    else&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        local res, err = red:get(redis_pattern .. ip);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        if err then&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            ngx.log(ngx.DEBUG, &amp;quot;Redis read error while retrieving ip_blacklist: &amp;quot; .. err);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            return&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        end&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        if res ~= ngx.null then&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            local ttl, err = red:ttl(redis_pattern .. ip);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if not ttl then&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                ngx.log(ngx.DEBUG, &amp;quot;Redis connection error while retrieving ttl&amp;quot; .. err);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                return&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            end&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            -- add IP to the ip_blacklist dict inheriting the TTL form redis&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            ip_blacklist:set(ip, true, ttl);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            ip_blacklist:set(&amp;quot;last_update_time&amp;quot;, ngx.now());&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        end&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    end&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;end&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In nginx add this lines:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;resolver&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 10.10.0.2&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; valid=10s&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;z-1 z-i&quot;&gt; # depends on your redis host&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;lua_package_path&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;/usr/share/lua/5.1/nginx/?.lua;/etc/nginx/lua/?.lua;;&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;lua_shared_dict&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; ip_blacklist 4m&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And call the scrip in the server section:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;server&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;    listen&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 80&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;    server_name&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; _&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;    access_by_lua_file&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; /etc/nginx/lua/ip_blacklist.lua&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;    ...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In Linux (ubuntu) this may be required:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;apt install nginx-extras lua-nginx-redis&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Golang HTTP Timeouts</title>
        <published>2017-12-01T20:00:24+01:00</published>
        <updated>2017-12-01T20:00:24+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/golang-http-timeouts/"/>
        <id>https://nbari.com/golang-http-timeouts/</id>
        
        <content type="html" xml:base="https://nbari.com/golang-http-timeouts/">&lt;p&gt;If this:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;http: Accept error: accept tcp [::]:80: accept4: too many open files; retrying in 40ms&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Check that your go server is using proper timeouts, example:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;go&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;srv&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; := &amp;amp;&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;http&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;Server&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        Addr&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;:         &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;:80&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        Handler&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;:&lt;/span&gt;&lt;span&gt;      router&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ReadTimeout&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;  5&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; *&lt;/span&gt;&lt;span&gt; time&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span&gt;Second&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        WriteTimeout&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 10&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; *&lt;/span&gt;&lt;span&gt; time&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span&gt;Second&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;log&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt;Fatal&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;(&lt;/span&gt;&lt;span&gt;srv&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt;ListenAndServe&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;())&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;https://blog.cloudflare.com/the-complete-guide-to-golang-net-http-timeouts/&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Measuring the Listen Queue</title>
        <published>2017-12-01T11:46:32+01:00</published>
        <updated>2017-12-01T11:46:32+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/measuring-the-listen-queue/"/>
        <id>https://nbari.com/measuring-the-listen-queue/</id>
        
        <content type="html" xml:base="https://nbari.com/measuring-the-listen-queue/">&lt;p&gt;Run the command:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;netstat -Lan&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The command output may be the following:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;Current&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; listen queue sizes&lt;/span&gt;&lt;span&gt; (qlen/incqlen/maxqlen)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;Proto&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; Listen                           Local Address&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;tcp46&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; 1863/0/32768&lt;/span&gt;&lt;span&gt;                     *&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;.80&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;tcp4&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;  0/0/128&lt;/span&gt;&lt;span&gt;                          *&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;.31025&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;tcp6&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;  0/0/128&lt;/span&gt;&lt;span&gt;                          *&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;.31025&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;Some&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; tcp sockets may have been deleted.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;unix&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;  0/0/32768                        /var/run/immortal/tuip/immortal.sock&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;unix&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;  0/0/255                          /var/db/syslog-ng.ctl&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;unix&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;  0/0/4                            /var/run/devd.pipe&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;unix&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;  0/0/4                            /var/run/devd.seqpacket.pipe&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The command output shows that there are &lt;strong&gt;1863&lt;/strong&gt; unaccepted connections in the listen
queue on Port 80, while the connection limit is &lt;strong&gt;32768&lt;/strong&gt; connections, and this
situation is normal.&lt;/p&gt;
&lt;p&gt;However, the command output may be as follows:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Current listen queue sizes (qlen/incqlen/maxqlen)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Listen         Local Address&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0/0/128        *.12345&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;192/0/128        *.80&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0/0/128        *.8080&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The command output shows &lt;strong&gt;192&lt;/strong&gt; unaccepted connections which exceeds the limit of
&lt;strong&gt;128&lt;/strong&gt; connections. This is quite common when a web site experience heavy traffic.&lt;/p&gt;
&lt;h2 id=&quot;tuning-the-operating-system&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#tuning-the-operating-system&quot; aria-label=&quot;Anchor link for: tuning-the-operating-system&quot;&gt;🔗&lt;/a&gt;Tuning the Operating System&lt;/h2&gt;
&lt;p&gt;Increase the value of the &lt;code&gt;somaxconn&lt;/code&gt; key from its default value (&lt;strong&gt;128&lt;/strong&gt;)
to the value high enough to be able to handle a high burst of traffic:&lt;/p&gt;
&lt;p&gt;For FreeBSD:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sysctl kern.ipc.somaxconn=4096&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;For Linux:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sudo sysctl -w net.core.somaxconn=4096&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;tuning-nginx&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#tuning-nginx&quot; aria-label=&quot;Anchor link for: tuning-nginx&quot;&gt;🔗&lt;/a&gt;Tuning NGINX&lt;/h2&gt;
&lt;p&gt;If you set the somaxconn key to a value greater than &lt;strong&gt;512&lt;/strong&gt;, change the backlog
parameter of the NGINX listen directive to match:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;server {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    listen 80 backlog=4096;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # The rest of server configuration&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;See also:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;/post/time_wait&quot;&gt;Time Wait&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;https://www.nginx.com/resources/admin-guide/serving-static-content/&lt;/li&gt;
&lt;/ul&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>appengine cost &gt; 150/s requests</title>
        <published>2017-12-01T10:33:35+01:00</published>
        <updated>2017-12-01T10:33:35+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/appengine/"/>
        <id>https://nbari.com/appengine/</id>
        
        <content type="html" xml:base="https://nbari.com/appengine/">&lt;p&gt;Between $5 and $7 USD per day will cost to host in
&lt;a rel=&quot;external&quot; href=&quot;https://cloud.google.com/appengine/&quot;&gt;appengine&lt;/a&gt; a tiny &lt;a rel=&quot;external&quot; href=&quot;https://golang.org&quot;&gt;go&lt;/a&gt;
application, with an average of 150 request/second, incoming bandwidth &amp;gt; 7GB and
outgoing bandwidth &amp;lt; 1GB.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;close to $25 per month, including the network internet egress&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;img src=&quot;/img/appengine-cost.png&quot; alt=&quot;appengine cost&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Sumary:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/img/appengine-sumary.png&quot; alt=&quot;appengine summary&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Upgrade Insecure Requests</title>
        <published>2017-11-28T15:55:03+01:00</published>
        <updated>2017-11-28T15:55:03+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/upgrade-insecure-requests/"/>
        <id>https://nbari.com/upgrade-insecure-requests/</id>
        
        <content type="html" xml:base="https://nbari.com/upgrade-insecure-requests/">&lt;p&gt;The &quot;Upgrade Insecure Requests&quot; Content Security Policy can be used to
automatically upgrade insecure (e.g. http:) requests to a secure alternative
(e.g. https:) before a browser fetches them.&lt;/p&gt;
&lt;p&gt;In practice, this helps avoid mixed-content warnings when a page is accessed via
https:, but it contains references to resources using absolute http: URLs.&lt;/p&gt;
&lt;p&gt;Like other Content Security Policies, the recommend approach is to enable it
via a HTTP response header:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Content-Security-Policy: upgrade-insecure-requests&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Nginx example:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;add_header Content-Security-Policy upgrade-insecure-requests;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;However, if you do not have control over the underlying web server, an
alternative is to include this meta tag in your HTML&#39;s &lt;code&gt;&amp;lt;head&amp;gt;&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;meta http-equiv=&amp;quot;Content-Security-Policy&amp;quot; content=&amp;quot;upgrade-insecure-requests&amp;quot;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;More info:&lt;/p&gt;
&lt;p&gt;https://googlechrome.github.io/samples/csp-upgrade-insecure-requests/&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>osxfuse</title>
        <published>2017-11-26T09:26:07+01:00</published>
        <updated>2017-11-26T09:26:07+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/osxfuse/"/>
        <id>https://nbari.com/osxfuse/</id>
        
        <content type="html" xml:base="https://nbari.com/osxfuse/">&lt;p&gt;To install:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;brew cask install osxfuse&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To install sshfuse:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;brew install sshfs&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Mount the root volume of remote host:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sshfs bastion:/ /tmp/host -o reconnect,follow_symlinks,volname=&amp;quot;LocalRemote&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To unmount:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sudo diskutil umount force /tmp/bastion&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>sh loop</title>
        <published>2017-11-23T18:46:11+01:00</published>
        <updated>2017-11-23T18:46:11+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/sh-loop/"/>
        <id>https://nbari.com/sh-loop/</id>
        
        <content type="html" xml:base="https://nbari.com/sh-loop/">&lt;p&gt;Easy shell &lt;code&gt;sh&lt;/code&gt; loop within a range:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ for i in $(seq 1 3); do echo $i; done&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;2&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;3&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>git format-patch</title>
        <published>2017-11-19T20:34:45+01:00</published>
        <updated>2017-11-19T20:34:45+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/git-format-patch/"/>
        <id>https://nbari.com/git-format-patch/</id>
        
        <content type="html" xml:base="https://nbari.com/git-format-patch/">&lt;p&gt;To create a patch of the latest commit:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;git format-patch -1 HEAD&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The last 10 patches from head in a single patch file:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;git format-patch -10 HEAD --stdout &amp;gt; last-10-commits.patch&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Apply the patch:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;git apply path-file-name&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>rsyslog 2 syslog-ng</title>
        <published>2017-11-16T17:21:16+01:00</published>
        <updated>2017-11-16T17:21:16+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/rsyslog2syslog-ng/"/>
        <id>https://nbari.com/rsyslog2syslog-ng/</id>
        
        <content type="html" xml:base="https://nbari.com/rsyslog2syslog-ng/">&lt;p&gt;To forward all logs from &lt;code&gt;rsyslog&lt;/code&gt; to &lt;code&gt;syslog-ng&lt;/code&gt;, add at the end of file &lt;code&gt;/etc/rsyslog.conf&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;*.* @@(o)log.server.tld:601;RSYSLOG_SyslogProtocol23Format&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;@@&lt;/code&gt; is for sending logs via TCP on port 601&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;(o)&lt;/code&gt; configures proper framing&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;RSYSLOG_SyslogProtocol23Format&lt;/code&gt; adds the RFC5424 template&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Using the RFC5424 syslog protocol with plain TCP between rsyslog and syslog-ng: https://www.balabit.com/blog/using-rfc5424-syslog-protocol-plain-tcp-rsyslog-syslog-ng/&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>ncdu</title>
        <published>2017-11-14T10:19:51+01:00</published>
        <updated>2017-11-14T10:19:51+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/ncdu/"/>
        <id>https://nbari.com/ncdu/</id>
        
        <content type="html" xml:base="https://nbari.com/ncdu/">&lt;p&gt;&lt;code&gt;ncdu&lt;/code&gt; helps displaying disk usage in an easy way, to install:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;brew install ncdu&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To scan and browse the directory you&#39;re currently in, all you need is a simple:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ncdu&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If you want to scan a full filesystem, your root filesystem, for example, then
you&#39;ll want to use &quot;-x&quot;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ncdu -x /&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;All files read only and in local machine:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sudo ncdu -rx /&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;-r&lt;/code&gt; option is for read only mode, option &lt;code&gt;-x&lt;/code&gt; is to stay in the same file
system (do not traverse other filesystem mounts)&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>openvpn 2fa</title>
        <published>2017-11-13T18:36:27+01:00</published>
        <updated>2017-11-13T18:36:27+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/openvpn-2fa/"/>
        <id>https://nbari.com/openvpn-2fa/</id>
        
        <content type="html" xml:base="https://nbari.com/openvpn-2fa/">&lt;p&gt;Setup OpenVPN + 2fa&lt;/p&gt;
&lt;p&gt;The way it works is that openvpn besides only allowing guest with a valid
certificate it will prompt users for a username and password in where username is
a system user and password is the OTP generated by the google authenticator.&lt;/p&gt;
&lt;p&gt;First you need to install &lt;code&gt;google-authenticator&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pkg install pam_google_authenticator&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Next create the file &lt;code&gt;/etc/pam.d/openvpn&lt;/code&gt; with this contents:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;auth            required        /usr/local/lib/pam_google_authenticator.so&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The openvpn configuration should look like this:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;# ------------------------------------------------------------------------------&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;# routed VPN&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;# ------------------------------------------------------------------------------&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;port&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 1194&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;proto&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; udp&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;dev&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; tun&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;topology&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; subnet&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;server&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 172.16.13.0 255.255.255.0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;tun-mtu&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 1400&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;ca&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; keys/ca.crt&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;cert&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; keys/server.crt&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; keys/server.key&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;dh&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; keys/dh2048.pem&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;tls-auth&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; keys/ta.key&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;key-direction&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;push&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;dhcp-option DNS 4.2.2.2&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;push&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;dhcp-option DNS 8.8.8.8&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;push&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;redirect-gateway def1&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;client-config-dir&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; ccd&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;plugin&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; /usr/local/lib/openvpn/plugins/openvpn-plugin-auth-pam.so openvpn&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;duplicate-cn&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;cipher&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; AES-256-CBC&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;auth&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; SHA512&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;comp-lzo&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;max-clients&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 100&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; nobody&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;group&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; nobody&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;persist-key&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;persist-tun&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; openvpn-status.log&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;verb&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 4&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;keepalive&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 20 40&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;# certificate revoking list&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;# crl-verify keys/crl.pem&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Notice the line:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;plugin /usr/local/lib/openvpn/plugins/openvpn-plugin-auth-pam.so openvpn&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The client side should be something like this:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;client&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;dev&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; tun&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;proto&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; udp&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;remote&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; X.X.X.X&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 1194&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;resolv-retry&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; infinite&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;nobind&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;persist-key&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;persist-tun&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;comp-lzo&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;key-direction&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;cipher&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; AES-256-CBC&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;auth&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; SHA512&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;verb&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 3&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;auth-user-pass&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;auth-nocache&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;ca&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;-----BEGIN&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; CERTIFICATE-----&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;-----END&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; CERTIFICATE-----&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;/ca&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;cert&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;-----BEGIN&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; CERTIFICATE-----&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;-----END&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; CERTIFICATE-----&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;/cert&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;key&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;-----BEGIN&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; PRIVATE KEY-----&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;-----END&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; PRIVATE KEY-----&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;/key&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;tls-auth&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;-----BEGIN&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; OpenVPN Static key V1-----&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;-----END&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; OpenVPN Static key V1-----&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;/tls-auth&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Notice the:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;auth-user-pass&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;auth-nocache&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&quot;add-users-create-sign-certs&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#add-users-create-sign-certs&quot; aria-label=&quot;Anchor link for: add-users-create-sign-certs&quot;&gt;🔗&lt;/a&gt;Add users (create &amp;amp; sign certs)&lt;/h3&gt;
&lt;p&gt;First create user certificate by doing something like (this can be created by user and the admin could only sign the cert):&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;openssl req -new -newkey rsa:2048 -nodes -out guest.csr -keyout guest.key -subj &amp;quot;/C=DE/ST=Germany/L=Berlin/O=acme/OU=IT/CN=guest&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;With the server key you need to sign the &lt;code&gt;guest.csr&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;openssl x509 -req -in guest.csr -CA ca.crt -CAkey ca.key -set_serial 01 -out users/guest.crt -days 7&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In this case the &lt;code&gt;guest.crt&lt;/code&gt; will be only valid for 7 days.&lt;/p&gt;
&lt;h3 id=&quot;create-the-2fa-codes-for-the-user&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#create-the-2fa-codes-for-the-user&quot; aria-label=&quot;Anchor link for: create-the-2fa-codes-for-the-user&quot;&gt;🔗&lt;/a&gt;create the 2fA codes for the user&lt;/h3&gt;
&lt;p&gt;The easy way is to create / add user to the system &lt;code&gt;adduser&lt;/code&gt;, once the user has been created you could run this command:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;su - guest -c google-authenticator&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This will create a file in the &lt;code&gt;guest&lt;/code&gt; user $HOME: &lt;code&gt;/home/test/.google_authenticator&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ cat .google_authenticator&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;35NIQ7S2T44WT5ZC&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;quot; RATE_LIMIT 3 30 1510594908 1510594922&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;quot; WINDOW_SIZE 17&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;quot; DISALLOW_REUSE 50353163&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;quot; TOTP_AUTH&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;53344656&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;94746893&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;13420893&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;11387169&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;23988009&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The &lt;code&gt;35NIQ7S2T44WT5ZC&lt;/code&gt; is the seed / code you need to use within your app that
generates the codes for example in authy it will be here:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/img/authy-enter-code.png&quot; alt=&quot;authy enter code&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;&lt;/p&gt;
&lt;p&gt;This should be enough for a starting point.&lt;/p&gt;
&lt;p&gt;To test that the &lt;code&gt;pam&lt;/code&gt; settings are working you could use &lt;code&gt;pamtester&lt;/code&gt;, for example:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# pamtester -v openvpn guest authenticate&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pamtester: invoking pam_start(openvpn, test, ...)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pamtester: performing operation - authenticate&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Verification code:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pamtester: successfully authenticated&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The verification code should be the one generated by your application.&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>pamtester</title>
        <published>2017-11-13T18:06:41+01:00</published>
        <updated>2017-11-13T18:06:41+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/pamtester/"/>
        <id>https://nbari.com/pamtester/</id>
        
        <content type="html" xml:base="https://nbari.com/pamtester/">&lt;p&gt;&lt;code&gt;pamtester&lt;/code&gt; can be used to test your PAM setup, to install it:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pkg install pamtester&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To test for example openvpn:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pamtester -v openvpn test authenticate&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Wait Process to Finish</title>
        <published>2017-11-11T09:27:21+01:00</published>
        <updated>2017-11-11T09:27:21+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/wait-process-to-finish/"/>
        <id>https://nbari.com/wait-process-to-finish/</id>
        
        <content type="html" xml:base="https://nbari.com/wait-process-to-finish/">&lt;p&gt;Cross platform solutution:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;while kill -0 PID 2&amp;gt; /dev/null; do sleep 1; done;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Example:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ sleep 60 &amp;amp;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ while kill -0 $!; do echo 1 &amp;amp;&amp;amp; sleep 0.5; done&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If using FreeBSD:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pwait&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Also &lt;code&gt;lsoft&lt;/code&gt; can be used but requires that the &lt;code&gt;$pid&lt;/code&gt; has open files:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;lsof -p $pid +r 1 &amp;amp;&amp;gt;/dev/null&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>netcat</title>
        <published>2017-11-10T20:50:51+01:00</published>
        <updated>2017-11-10T20:50:51+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/netcat/"/>
        <id>https://nbari.com/netcat/</id>
        
        <content type="html" xml:base="https://nbari.com/netcat/">&lt;p&gt;As a replacement to telnet now that has been removed from macOS,
&lt;a rel=&quot;external&quot; href=&quot;https://en.wikipedia.org/wiki/Netcat&quot;&gt;netcat&lt;/a&gt; can be used.&lt;/p&gt;
&lt;p&gt;To test the response from a web server:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;echo -en &amp;quot;GET / HTTP/1.0\n\n\n&amp;quot; | nc google.com 80&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If using HTTP/1.1 the host will be required:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;echo -en &amp;quot;GET / HTTP/1.1\nHost: google.com\n\n&amp;quot; | nc google.com 80&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Test to see if port accepts connections:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; nc -vz google.com&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 80&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;found&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 0&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; associations&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;found&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 1&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; connections:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;     1:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; flags=&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;82&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;CONNECTED,PREFERRE&lt;/span&gt;&lt;span&gt;D&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;        outif&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; en1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;        src&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 192.168.1.100&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; port&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 50532&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;        dst&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 216.58.211.110&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; port&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 80&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;        rank&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; info not available&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;        TCP&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; aux info available&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;Connection&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; to google.com port&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 80&lt;/span&gt;&lt;span&gt; [tcp/http] succeeded&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;!&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The -z option is specifies that &lt;code&gt;nc&lt;/code&gt; should just scan for listening daemons,
without sending any data to them. If using just -v it will keep connection open
and &lt;code&gt;ctrl + c&lt;/code&gt; could be used to close the connection.&lt;/p&gt;
&lt;h3 id=&quot;like-telnet&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#like-telnet&quot; aria-label=&quot;Anchor link for: like-telnet&quot;&gt;🔗&lt;/a&gt;like telnet&lt;/h3&gt;
&lt;p&gt;To send data instead like where in telnet use the option &lt;code&gt;-t&lt;/code&gt; which causes &lt;code&gt;nc&lt;/code&gt;
to send RFC 854 DON&#39;T and WON&#39;T responses to RFC 854 DO and WILL requests. This
makes it possible to use &lt;code&gt;nc&lt;/code&gt; to script telnet sessions.&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; nc -vt google.com&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 80&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;found&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 0&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; associations&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;found&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 1&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; connections:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;     1:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; flags=&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;82&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;CONNECTED,PREFERRE&lt;/span&gt;&lt;span&gt;D&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;        outif&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; en1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;        src&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 192.168.1.100&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; port&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 50532&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;        dst&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 216.58.211.110&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; port&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 80&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;        rank&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; info not available&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;        TCP&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; aux info available&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;Connection&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; to google.com port&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 80&lt;/span&gt;&lt;span&gt; [tcp/http] succeeded&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;!&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;GET&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; /&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;   &amp;lt;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;------- you write this&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&quot;scan&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#scan&quot; aria-label=&quot;Anchor link for: scan&quot;&gt;🔗&lt;/a&gt;scan&lt;/h3&gt;
&lt;p&gt;To scan a range of ports:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;nc -zvn your-target.tld 1-1000&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;The &lt;code&gt;-n&lt;/code&gt; option is to avoid doing any DNS or service lookups&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;To print the TPC banner of the running service this could be used:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;echo &amp;quot;&amp;quot; | nc -vn -w1 -G1 your-target.tld -r 1-1000&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The &lt;code&gt;-w1&lt;/code&gt; is for waiting no more than 1 second if the connection and stdin are
idle, the &lt;code&gt;echo &quot;&quot;&lt;/code&gt; send a black string to the open port and print out any
banner received in response.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;-G1&lt;/code&gt; sets the ctp connection timeout to 1 second.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;-r&lt;/code&gt; specifies that the source and/or destination ports should chosen
randomly instead of sequentially.&lt;/p&gt;
&lt;p&gt;https://docs.saltstack.com/en/latest/topics/mine/&lt;/p&gt;
&lt;h3 id=&quot;listen-for-connections&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#listen-for-connections&quot; aria-label=&quot;Anchor link for: listen-for-connections&quot;&gt;🔗&lt;/a&gt;listen for connections&lt;/h3&gt;
&lt;p&gt;To open a port and keep listening on it, useful for testing incoming
connections:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;nc -lk 8080&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To test you can connect to the opened port by doing:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;nc -vt 0 8080&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;0 stands for localhost but you could use the IP (192.168.X.X) for example&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3 id=&quot;transfer-a-file&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#transfer-a-file&quot; aria-label=&quot;Anchor link for: transfer-a-file&quot;&gt;🔗&lt;/a&gt;transfer a file&lt;/h3&gt;
&lt;p&gt;On the server where you want to store the file:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;nc -l 8080 &amp;gt;  outfile&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;On the client where you have the file that you want to send:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;nc X.X.X.X 8080 &amp;lt; infile&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>shasum</title>
        <published>2017-11-08T11:40:03+01:00</published>
        <updated>2017-11-08T11:40:03+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/shasum/"/>
        <id>https://nbari.com/shasum/</id>
        
        <content type="html" xml:base="https://nbari.com/shasum/">&lt;p&gt;Create a &lt;code&gt;checksum&lt;/code&gt; file for all files within a directory:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ shasum * &amp;gt; checksum&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Check the checksum:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ shasum -c checksum&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To use &lt;code&gt;sha256&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ shasum -a 256 * &amp;gt; checksum&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>RF clock setting the time manully</title>
        <published>2017-10-29T11:35:38+01:00</published>
        <updated>2017-10-29T11:35:38+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/rf-clock-setting-the-time-manully/"/>
        <id>https://nbari.com/rf-clock-setting-the-time-manully/</id>
        
        <content type="html" xml:base="https://nbari.com/rf-clock-setting-the-time-manully/">&lt;p&gt;&lt;img src=&quot;/img/rf-wall-clock.jpg&quot; alt=&quot;rf clock&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/img/rf-wall-clock-back.png&quot; alt=&quot;rf clock&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Press and hold the M.SET button for 3 seconds to set the time:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Press the M.SET button for 1 second to advance 1 minute.&lt;/li&gt;
&lt;li&gt;Press the M.SET button for more than 1 second to auto advance the minute hand.&lt;/li&gt;
&lt;li&gt;If the M.SET button is not pressed for 8 seconds, or press REC button, the clock is set.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;start-manual-reception&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#start-manual-reception&quot; aria-label=&quot;Anchor link for: start-manual-reception&quot;&gt;🔗&lt;/a&gt;Start manual reception&lt;/h2&gt;
&lt;p&gt;Press the REC button for 3 seconds. The hands will move to the 12:00 position
and the clock will start searching for the DCF signal. Once the DCF signal will
be received properly, it will automatically set to the correct time. If no
signal is received, the clock returns to the previously stored time.&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>pipenv + ansible</title>
        <published>2017-10-24T23:37:05+02:00</published>
        <updated>2017-10-24T23:37:05+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/pipenv-ansible/"/>
        <id>https://nbari.com/pipenv-ansible/</id>
        
        <content type="html" xml:base="https://nbari.com/pipenv-ansible/">&lt;p&gt;First install &lt;a rel=&quot;external&quot; href=&quot;https://docs.pipenv.org/&quot;&gt;pipenv&lt;/a&gt; in case you don&#39;t have it:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pip install --user pipenv&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Next, for testing create a directory &lt;code&gt;/tmp/my-ansible&lt;/code&gt;, within that directory
create a file named &lt;code&gt;requirements.txt&lt;/code&gt; with the following content:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ansible&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;==&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;2.4&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;boto&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;==&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;2.48&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;boto3&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;==&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;1.4&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;4&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;paramiko&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;==&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;2.0&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;6&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;cd&lt;/code&gt; in to &lt;code&gt;/tmp/my-ansible&lt;/code&gt; or if you already have a working project &lt;code&gt;cd&lt;/code&gt; in to
it and run:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pipenv install -r requirements.txt&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Or you could just run:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pipenv install ansible&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It will create 2 new files &lt;code&gt;Pipfile&lt;/code&gt; and &lt;code&gt;Pipfile.lock&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;To active &lt;a rel=&quot;external&quot; href=&quot;https://virtualenv.pypa.io/en/stable/&quot;&gt;virtualenv&lt;/a&gt; in the project just run:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pipenv shell&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;That will activate the environment for your working directory and launch/run
your project based on your settings/requirements.txt.&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ansible --version&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;When finish just type &lt;code&gt;exit&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;In case you would like to remove the &lt;code&gt;virtualenv&lt;/code&gt; created by &lt;code&gt;pipenv&lt;/code&gt; run:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pipenv --rm&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;More info here: https://github.com/kennethreitz/pipenv&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>locale UTF8</title>
        <published>2017-10-23T11:54:35+02:00</published>
        <updated>2017-10-23T11:54:35+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/locale-utf8/"/>
        <id>https://nbari.com/locale-utf8/</id>
        
        <content type="html" xml:base="https://nbari.com/locale-utf8/">&lt;p&gt;To enable UTF-8 globally by default, update the default login class by adding at the end
this lines in file &lt;code&gt;/etc/login.conf&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   :charset=UTF-8:\&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   :lang=en_US.UTF-8:&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Normally add them after &lt;code&gt;:umask=022:&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;diff&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;       :umask=022:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;       :umask=022:\&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;       :charset=UTF-8:\&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;       :lang=en_US.UTF-8:&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;After modifying &lt;code&gt;/etc/login.conf&lt;/code&gt; run:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cap_mkdb /etc/login.conf&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This will rebuild the login class capabilities database.&lt;/p&gt;
&lt;h3 id=&quot;login-conf&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#login-conf&quot; aria-label=&quot;Anchor link for: login-conf&quot;&gt;🔗&lt;/a&gt;~/.login_conf&lt;/h3&gt;
&lt;p&gt;Users may individually create a file called &lt;code&gt;.login_conf&lt;/code&gt; in their home
directory using the same format, consisting of a single entry with a record id
of &lt;code&gt;me&lt;/code&gt;.&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; cat ~/.login_conf&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;me:\&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;        :charset=UTF-8:&lt;/span&gt;&lt;span&gt;\&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;        :lang=en_US.UTF-8:&lt;/span&gt;&lt;span&gt;\&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;        :setenv=LC_COLLATE=C:&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&quot;locale&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#locale&quot; aria-label=&quot;Anchor link for: locale&quot;&gt;🔗&lt;/a&gt;locale&lt;/h3&gt;
&lt;p&gt;Type &lt;code&gt;locale&lt;/code&gt; to verity that the new settings took effect:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# locale&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;LANG=en_US.UTF-8&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;LC_CTYPE=&amp;quot;en_US.UTF-8&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;LC_COLLATE=&amp;quot;en_US.UTF-8&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;LC_TIME=&amp;quot;en_US.UTF-8&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;LC_NUMERIC=&amp;quot;en_US.UTF-8&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;LC_MONETARY=&amp;quot;en_US.UTF-8&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;LC_MESSAGES=&amp;quot;en_US.UTF-8&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;LC_ALL=&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Plex within a FreeBSD jail</title>
        <published>2017-10-22T22:23:25+02:00</published>
        <updated>2017-10-22T22:23:25+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/plex-jail/"/>
        <id>https://nbari.com/plex-jail/</id>
        
        <content type="html" xml:base="https://nbari.com/plex-jail/">&lt;p&gt;For downloading metadata plex uses &lt;code&gt;127.0.0.1&lt;/code&gt; therefore the
jail needs to have a loopback interface.&lt;/p&gt;
&lt;p&gt;Create a &lt;code&gt;lo1&lt;/code&gt; interface, add to &lt;code&gt;rc.conf&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cloned_interfaces=&amp;quot;lo1&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Add first the loopback IP in the &lt;code&gt;jail.conf&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;plex&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;    ip4.addr&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;  = lo1&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;127.0.2.1&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;    ip4.addr&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; += igb0&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;172.16.8.2&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;    path&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;      =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;/fabrik/jail/plex&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This will add as the main IP &lt;code&gt;127.0.2.1&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Inside a jail, access to the loopback address 127.0.0.1 is redirected to the
first IP address assigned to the jail. To make the jail loopback correspond with
the new lo1 interface, that interface must be specified first in the list of
interfaces and IP addresses given when creating a new jail.&lt;/p&gt;
&lt;p&gt;Edit &lt;code&gt;/etc/hosts&lt;/code&gt; in the jail so that localhost uses IP &lt;code&gt;127.0.2.1&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;127.0.2.1       localhost  localhost.your.domain&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;claiming-your-server&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#claiming-your-server&quot; aria-label=&quot;Anchor link for: claiming-your-server&quot;&gt;🔗&lt;/a&gt;Claiming your server&lt;/h2&gt;
&lt;p&gt;You claim/configure your new plex server, you need to run it on a private
network, and later just redirect / forward the port so that It can be reached
from plex.tv/web.&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;rdr on $ext_if proto tcp from any to any port 32400 -&amp;gt; 172.16.8.2 port 32400&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Bhyve + IPv6</title>
        <published>2017-10-20T11:21:40+02:00</published>
        <updated>2017-10-20T11:21:40+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/bhyve-ipv6/"/>
        <id>https://nbari.com/bhyve-ipv6/</id>
        
        <content type="html" xml:base="https://nbari.com/bhyve-ipv6/">&lt;p&gt;bhyve + ipv6&lt;/p&gt;
&lt;p&gt;This is how to set assign IPv6 addresses to guest within
&lt;a rel=&quot;external&quot; href=&quot;http://bhyve.org/&quot;&gt;bhyve&lt;/a&gt; on a server with one single network card, the trick
to make this to work is to assign the/handle the IPs within the bridge in
&lt;code&gt;auto_linklocal&lt;/code&gt; mode.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;rc.conf&lt;/code&gt; file:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ifconfig_igb0&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;inet X.X.X.X netmask 255.255.255.XXX&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;defaultrouter&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;X.X.X.X&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gateway_enable&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;YES&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ipv6_activate_all_interfaces&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;YES&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ipv6_defaultrouter&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;fe80::1%bridge0&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ipv6_gateway_enable&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;YES&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cloned_interfaces&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;bridge0 tap0&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;autobridge_interfaces&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;bridge0&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;autobridge_bridge0&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;tap* igb0&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ifconfig_bridge0&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;addm igb0 addm tap0 up description bhyve&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ifconfig_bridge0_ipv6&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;inet6 2a01:4f8:350:84ec::1 prefixlen 64 auto_linklocal&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;rtadvd_enable&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;YES&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;rtadvd_interfaces&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;bridge0&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The &lt;code&gt;rtadvd.conf&lt;/code&gt; file:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;bridge0:\&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;    :addr=&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;2a01:4f8:350:84ec::&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;:prefixlen#64:&lt;/span&gt;&lt;span&gt;\&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;    :rdnss=&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;2a01:4f8:350:84ec::1&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;:&lt;/span&gt;&lt;span&gt;\&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;    :dnssl=&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;nbari.com&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;:&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;By doing this, the bhyve guest VM&#39;s can ping the main host, and use local
services like unbound for DNS resolution.&lt;/p&gt;
&lt;p&gt;In the logs you will notice something like this:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;bridge0: IPv6 addresses on igb0 have been removed before adding it as a member to prevent IPv6 address scope violation.&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This can be avoided by using:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sysctl net.link.bridge.allow_llz_overlap=1&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;But will cause in terms that the guests may get an IP but not the router gateway.&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>netstat Bytes in Out</title>
        <published>2017-10-20T00:12:06+02:00</published>
        <updated>2017-10-20T00:12:06+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/netstat-bytes-in-out/"/>
        <id>https://nbari.com/netstat-bytes-in-out/</id>
        
        <content type="html" xml:base="https://nbari.com/netstat-bytes-in-out/">&lt;p&gt;To get bytes in/out:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# netstat -bI bridge0&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;For example to get bytes in/out on tap interface:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# netstat -bI tap0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Name    Mtu Network       Address              Ipkts Ierrs Idrop     Ibytes    Opkts Oerrs     Obytes  Coll&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;tap0*  1500 &amp;lt;Link#7&amp;gt;      00:bd:49:f6:f6:00     1689     0     0     153380        0     0     161697     0&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>tcpdump IPv6</title>
        <published>2017-10-19T15:29:42+02:00</published>
        <updated>2017-10-19T15:29:42+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/tcpdump-ipv6/"/>
        <id>https://nbari.com/tcpdump-ipv6/</id>
        
        <content type="html" xml:base="https://nbari.com/tcpdump-ipv6/">&lt;p&gt;To capture ipv6 traffic using tcpdump:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# tcpdump -vvv ip6 -i igb0&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;replace igb0 with your network card&lt;/p&gt;
&lt;/blockquote&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>ansible ImportError: No module named boto3</title>
        <published>2017-10-16T17:21:57+02:00</published>
        <updated>2017-10-16T17:21:57+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/ansible-no-module-named-boto3/"/>
        <id>https://nbari.com/ansible-no-module-named-boto3/</id>
        
        <content type="html" xml:base="https://nbari.com/ansible-no-module-named-boto3/">&lt;p&gt;When using &lt;code&gt;ansible 2.4.0.0&lt;/code&gt; (macOS) to fix this problem update your library:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;pip&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; install --upgrade --user boto3&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;notice the --user it will update, your local $HOME/Library/Python/2.7/lib/python/site-packages&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;By using &lt;code&gt;--upgrade&lt;/code&gt; it will recreate the &lt;code&gt;site-packages&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Or create &lt;code&gt;PYTHONPATH&lt;/code&gt; system variable:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;export PYTHONPATH=/usr/local/lib/python2.7/site-packages&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&quot;paramiko&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#paramiko&quot; aria-label=&quot;Anchor link for: paramiko&quot;&gt;🔗&lt;/a&gt;paramiko&lt;/h3&gt;
&lt;p&gt;In case you get this error:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Unicode-objects must be encoded before hashing&amp;quot;, &amp;quot;unreachable&amp;quot;: true&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Try:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pip install --upgrade --user paramiko==2.0.6&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To upgrade,reinstall ansible just in case:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pip install --upgrade --user ansible&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>pflog</title>
        <published>2017-10-14T22:52:39+02:00</published>
        <updated>2017-10-14T22:52:39+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/pflog/"/>
        <id>https://nbari.com/pflog/</id>
        
        <content type="html" xml:base="https://nbari.com/pflog/">&lt;p&gt;To monitor all packets loged when using &lt;a rel=&quot;external&quot; href=&quot;https://www.freebsd.org/cgi/man.cgi?query=pflog&quot;&gt;pflog&lt;/a&gt;, use:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;tcpdump -n -e -ttt -i pflog0&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To find the rule by number:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pfctl -vvsr&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;For nat:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pfctl -vvsn&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In macOS to create the &lt;code&gt;pflog0&lt;/code&gt; interface:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sudo ifconfig pflog0 create&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You can remove it with:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sudo ifconfig pflog0 destroy&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>bsdinstall MANIFEST</title>
        <published>2017-10-13T17:05:16+02:00</published>
        <updated>2017-10-13T17:05:16+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/bsdinstall-manifest/"/>
        <id>https://nbari.com/bsdinstall-manifest/</id>
        
        <content type="html" xml:base="https://nbari.com/bsdinstall-manifest/">&lt;p&gt;When installing FreeBSD from an ftp/http it may complain that &lt;code&gt;MANIFEST&lt;/code&gt; file is
missing, to solve the problem try this:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;export DISTRIBUTIONS=&amp;quot;kernel.txz base.txz&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mkdir /usr/freebsd-dist&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;export BSDINSTALL_DISTDIR=&amp;quot;/usr/freebsd-dist/&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;export BSDINSTALL_DISTSITE=&amp;quot;https://download.freebsd.org/ftp/releases/amd64/amd64/12.1-RELEASE/&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;bsdinstall distfetch&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cd /usr/freebsd-dist&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;fetch https://download.freebsd.org/ftp/releases/amd64/amd64/12.1-RELEASE/MANIFEST&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then run &lt;code&gt;bsdinstall&lt;/code&gt;&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Go Benchmarking</title>
        <published>2017-09-24T22:43:18+02:00</published>
        <updated>2017-09-24T22:43:18+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/go-bench/"/>
        <id>https://nbari.com/go-bench/</id>
        
        <content type="html" xml:base="https://nbari.com/go-bench/">&lt;p&gt;To exclude all the tests and just run the benchmarks:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;go test -run=^$ -bench=.&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Profile:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;go test -cpuprofile=cpu.out -benchmem -memprofile=mem.out -run=^$ -bench=&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Using &lt;code&gt;pprof&lt;/code&gt;:&lt;/p&gt;
&lt;p&gt;CPU:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;go tool pprof &amp;lt;your-binary&amp;gt;.test cpu.out&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;MEM:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;go tool pprof -alloc_objects &amp;lt;your-binary&amp;gt;.test mem.out&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Go Tooling in Action&lt;/p&gt;
&lt;div class=&quot;video-embed&quot;&gt;
    &lt;iframe src=&quot;https://www.youtube-nocookie.com/embed/uBjoTxosSys&quot; title=&quot;YouTube video&quot; loading=&quot;lazy&quot; allow=&quot;accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen&gt;&lt;/iframe&gt;
&lt;/div&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Plex FFmpeg</title>
        <published>2017-09-24T16:09:44+02:00</published>
        <updated>2017-09-24T16:09:44+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/plex-ffmpeg/"/>
        <id>https://nbari.com/plex-ffmpeg/</id>
        
        <content type="html" xml:base="https://nbari.com/plex-ffmpeg/">&lt;p&gt;Using &lt;a rel=&quot;external&quot; href=&quot;https://www.ffmpeg.org/&quot;&gt;ffmpeg&lt;/a&gt; to avoid &lt;a rel=&quot;external&quot; href=&quot;https://plex.tv&quot;&gt;PLEX&lt;/a&gt; transcoding.&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ffmpeg -i input.mp4 \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -c:v libx264 \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -profile:v high \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -level 5 \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -crf 18 \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -maxrate 10M \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -bufsize 16M \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -pix_fmt yuv420p \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -vf &amp;quot;scale=iw*sar:ih, scale=&amp;#39;if(gt(iw,ih),min(1920,iw),-1)&amp;#39;:&amp;#39;if(gt(iw,ih),-1,min(1080,ih))&amp;#39;&amp;quot; \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -x264opts bframes=3:cabac=1 \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -movflags faststart \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -c:a libfdk_aac \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -b:a 320k \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -y output.mp4&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;If parts of the file reside on physically bad sectors, or for whatever reason, the OS cannot serve the whole file to FFmpeg try: &lt;code&gt;ffmpeg -err_detect ignore_err -i input.mkv ...&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;To install ffmpeg:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;brew tap varenc/ffmpeg&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;brew install varenc/ffmpeg/ffmpeg --with-fdk-aac --HEAD&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To see more options:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;brew options varenc/ffmpeg/ffmpeg&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>zip -r</title>
        <published>2017-09-17T09:47:31+02:00</published>
        <updated>2017-09-17T09:47:31+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/zip-archive/"/>
        <id>https://nbari.com/zip-archive/</id>
        
        <content type="html" xml:base="https://nbari.com/zip-archive/">&lt;h1 id=&quot;create-and-append-archive-things-to-a-zip-file&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#create-and-append-archive-things-to-a-zip-file&quot; aria-label=&quot;Anchor link for: create-and-append-archive-things-to-a-zip-file&quot;&gt;🔗&lt;/a&gt;Create and append &quot;archive&quot; things to a zip file&lt;/h1&gt;
&lt;p&gt;Create a zip:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ zip -9 foo.zip file&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Add more things to the zip:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ zip -r9 foo.zip bar.txt&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ cd $VIRTUAL_ENV/lib/python2.7/site-packages&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ zip -r9 foo.zip *&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>AWS Policy Access by IP</title>
        <published>2017-09-15T22:50:11+02:00</published>
        <updated>2017-09-15T22:50:11+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/aws-policy-access-by-ip/"/>
        <id>https://nbari.com/aws-policy-access-by-ip/</id>
        
        <content type="html" xml:base="https://nbari.com/aws-policy-access-by-ip/">&lt;p&gt;Policy to restrict &lt;a rel=&quot;external&quot; href=&quot;http://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements.html#Condition&quot;&gt;IAM&lt;/a&gt; AWS API requests to a specific set of IP addresses.&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;Version&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;: &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;2012-10-17&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;Statement&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;: {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;Effect&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;: &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;Deny&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;Action&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;: &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;Resource&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;: &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;Condition&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;: {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;NotIpAddress&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;: {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;aws:SourceIp&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;: [&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                    &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;10.13.0.0/16&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                    &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;72.55.175.70/32&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                    &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;10.100.0.0/16&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                ]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;After applying this policy others may need to be applied or in case all in one
required, something like this can be used:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;Version&amp;quot;: &amp;quot;2012-10-17&amp;quot;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;Statement&amp;quot;: [{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;Effect&amp;quot;: &amp;quot;Deny&amp;quot;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;Action&amp;quot;: &amp;quot;*&amp;quot;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;Resource&amp;quot;: &amp;quot;*&amp;quot;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;Condition&amp;quot;: {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &amp;quot;NotIpAddress&amp;quot;: {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &amp;quot;aws:SourceIp&amp;quot;: [&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    &amp;quot;10.13.0.0/16&amp;quot;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    &amp;quot;72.55.175.70/32&amp;quot;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    &amp;quot;10.100.0.0/16&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                ]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }, {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;Effect&amp;quot;: &amp;quot;Allow&amp;quot;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;Action&amp;quot;: &amp;quot;*&amp;quot;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;Resource&amp;quot;: &amp;quot;*&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The expected error when policy is applied is similar to:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Error loading state: AccessDenied: Access Denied&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;status code: 403, request id: 5A14AE35A2D7CD1B, host id: ROyNOfAiBNojw7VTJ6tLsZeBjQ5YHILbjfubWg/D8R/C+4HORHGqcIw5ByyTr/HyOP3TWK8Ogbs=&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Time wait</title>
        <published>2017-09-05T14:45:47+02:00</published>
        <updated>2017-09-05T14:45:47+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/time-wait/"/>
        <id>https://nbari.com/time-wait/</id>
        
        <content type="html" xml:base="https://nbari.com/time-wait/">&lt;p&gt;Reduce TIME_WAIT connections&lt;/p&gt;
&lt;p&gt;How many TIME_WAITs you have hanging out (run this like root):&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;netstat -na -p tcp | awk &amp;#39;{print $6}&amp;#39; | sort | uniq -c | sort -n&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;On Linux:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;netstat -nat | awk &amp;#39;{print $6}&amp;#39; | sort | uniq -c | sort -n&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Output will be something like:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# netstat -na -p tcp | awk &amp;#39;{print $6}&amp;#39; | sort | uniq -c | sort -n&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   1 Foreign&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   1 LAST_ACK&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   1 been&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   3 LISTEN&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  25 SYN_RCVD&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;1455 CLOSE_WAIT&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;17518 ESTABLISHED&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The formula to calculate the value (net.inet.tcp.msl) to time of seconds is 2
times of the net.inet.tcp.msl value. which means the value of net.inet.tcp.msl
with 30000 means 60000ms (because 2x30000), thus 60 seconds. In order set
net.inet.tcp.msl to 15 seconds, change the value of net.inet.tcp.msl to 7500.
for example:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sysctl net.inet.tcp.msl=7500&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This will cause the TIME_WAIT sockets to terminate after waiting for 15 seconds,
if no reply from the destination that this connection can be terminated.&lt;/p&gt;
&lt;p&gt;This  can be added to the &lt;code&gt;/etc/sysctl.conf&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;net.inet.tcp.fast_finwait2_recycle=1 # recycle FIN/WAIT states quickly&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;net.inet.tcp.finwait2_timeout=15000  # TCP FIN_WAIT_2 timeout waiting for client FIN packet before state close (default 60000, 60 sec)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;net.inet.tcp.msl=2500                # Maximum Segment Lifetime, time the connection spends in TIME_WAIT state (default 30000, 2*MSL = 60 sec)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;notice the &lt;strong&gt;2500&lt;/strong&gt; it will be set to 5 seconds&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;On Linux edit &lt;code&gt;/etc/sysctl.conf&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Decrease TIME_WAIT seconds&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;net.ipv4.tcp_fin_timeout = 15&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;net.ipv4.tcp_tw_reuse = 1&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;net.ipv4.tcp_tw_recycle has been removed from Linux 4.12. https://vincent.bernat.im/en/blog/2014-tcp-time-wait-state-linux&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;img src=&quot;/img/tcp_state_diagram.png&quot; alt=&quot;tcp state diagram&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Transmission Control Protocol (TCP) is designed to be a bidirectional, ordered,
and reliable data transmission protocol between two end points (programs). In
this context, the term reliable means that it will retransmit the packets if
it gets lost in the middle. TCP guarantees the reliability by sending back
Acknowledgment (ACK) packets back for a single or a range of packets received
from the peer.&lt;/p&gt;
&lt;p&gt;This goes same for the control signals such as termination request/response.
[RFC 793][1] defines the TIME-WAIT state to be as follows:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;TIME-WAIT - represents waiting for enough time to pass to be sure the remote
TCP received the acknowledgment of its connection termination request.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;TCP is a bidirectional communication protocol, so when the connection is
established, there is not a difference between the client and the server. Also,
either one can call quits, and both peers needs to agree on closing to fully
close an established TCP connection.&lt;/p&gt;
&lt;p&gt;Let&#39;s call the first one to call the quits as the active closer, and the other
peer the passive closer. When the active closer sends FIN, the state goes to
FIN-WAIT-1. Then it receives an ACK for the sent FIN and the state goes to
FIN-WAIT-2. Once it receives FIN also from the passive closer, the active closer
sends the ACK to the FIN and the state goes to TIME-WAIT. In case the passive
closer did not received the ACK to the second FIN, it will retransmit the FIN
packet.&lt;/p&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://tools.ietf.org/html/rfc793&quot;&gt;RFC 793&lt;/a&gt; sets the TIME-OUT to be twice the
Maximum Segment Lifetime, or 2MSL. Since MSL, the maximum time a packet can
wander around Internet, is set to 2 minutes, 2MSL is 4 minutes. Since there is
no ACK to an ACK, the active closer can&#39;t do anything but to wait 4 minutes if
it adheres to the TCP/IP protocol correctly, just in case the passive sender has
not received the ACK to its FIN (theoretically).&lt;/p&gt;
&lt;p&gt;In reality, missing packets are probably rare, and very rare if it&#39;s all
happening within the LAN or within a single machine.&lt;/p&gt;
&lt;p&gt;See also:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;https://calomel.org/freebsd_network_tuning.html&lt;/li&gt;
&lt;li&gt;http://www.linuxbrigade.com/reduce-time_wait-socket-connections/&lt;/li&gt;
&lt;li&gt;https://serverfault.com/a/329846/94862&lt;/li&gt;
&lt;/ul&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Strace</title>
        <published>2017-08-31T11:25:27+02:00</published>
        <updated>2017-08-31T11:25:27+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/strace/"/>
        <id>https://nbari.com/strace/</id>
        
        <content type="html" xml:base="https://nbari.com/strace/">&lt;p&gt;When using strace, to trace child processes, use option &lt;code&gt;-f&lt;/code&gt;, example:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;strace -f ls&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Webcrypto and Go</title>
        <published>2017-08-17T18:14:57+02:00</published>
        <updated>2017-08-17T18:14:57+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/webcrypto-and-go/"/>
        <id>https://nbari.com/webcrypto-and-go/</id>
        
        <content type="html" xml:base="https://nbari.com/webcrypto-and-go/">&lt;p&gt;Encrypt on client side using javascript
&lt;a rel=&quot;external&quot; href=&quot;https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API&quot;&gt;WebCrypto&lt;/a&gt; and
decrypt on backend using &lt;a rel=&quot;external&quot; href=&quot;https://golang.org/&quot;&gt;go&lt;/a&gt;:&lt;/p&gt;
&lt;p&gt;javascript code:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-8&quot;&gt;async function&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt; aesGcmEncrypt&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;(&lt;/span&gt;&lt;span class=&quot; z-i&quot;&gt;plaintext&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;,&lt;/span&gt;&lt;span class=&quot; z-i&quot;&gt; password&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;) {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-8&quot;&gt;    const&lt;/span&gt;&lt;span&gt; pwUtf8&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; = new&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt; TextEncoder&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt;encode&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;(&lt;/span&gt;&lt;span&gt;password&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;                                 // encode password as UTF-8&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-8&quot;&gt;    const&lt;/span&gt;&lt;span&gt; pwHash&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; =&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt; await&lt;/span&gt;&lt;span&gt; crypto&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span&gt;subtle&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt;digest&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;SHA-256&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39;,&lt;/span&gt;&lt;span&gt; pwUtf8&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;                      // hash the password&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-8&quot;&gt;    const&lt;/span&gt;&lt;span&gt; iv&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; =&lt;/span&gt;&lt;span&gt; crypto&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt;getRandomValues&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt; Uint8Array&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;12&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;))&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;                             // get 96-bit random iv&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-8&quot;&gt;    const&lt;/span&gt;&lt;span&gt; alg&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; = {&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; name&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;: &amp;#39;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;AES-GCM&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39;,&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; iv&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;:&lt;/span&gt;&lt;span&gt; iv&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; };&lt;/span&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;                                           // specify algorithm to use&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-8&quot;&gt;    const&lt;/span&gt;&lt;span&gt; key&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; =&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt; await&lt;/span&gt;&lt;span&gt; crypto&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span&gt;subtle&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt;importKey&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;raw&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39;,&lt;/span&gt;&lt;span&gt; pwHash&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;,&lt;/span&gt;&lt;span&gt; alg&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;z-11&quot;&gt; false&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; [&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;encrypt&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;])&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;z-1 z-i&quot;&gt; // generate key from pw&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-8&quot;&gt;    const&lt;/span&gt;&lt;span&gt; ptUint8&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; = new&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt; TextEncoder&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt;encode&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;(&lt;/span&gt;&lt;span&gt;plaintext&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;                               // encode plaintext as UTF-8&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-8&quot;&gt;    const&lt;/span&gt;&lt;span&gt; ctBuffer&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; =&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt; await&lt;/span&gt;&lt;span&gt; crypto&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span&gt;subtle&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt;encrypt&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;(&lt;/span&gt;&lt;span&gt;alg&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;,&lt;/span&gt;&lt;span&gt; key&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;,&lt;/span&gt;&lt;span&gt; ptUint8&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;                   // encrypt plaintext using key&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-8&quot;&gt;    const&lt;/span&gt;&lt;span&gt; ctArray&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; =&lt;/span&gt;&lt;span&gt; Array&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt; Uint8Array&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;(&lt;/span&gt;&lt;span&gt;ctBuffer&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;))&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;                              // ciphertext as byte array&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-8&quot;&gt;    const&lt;/span&gt;&lt;span&gt; ctStr&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; =&lt;/span&gt;&lt;span&gt; ctArray&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;(&lt;/span&gt;&lt;span class=&quot; z-i&quot;&gt;byte&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt; =&amp;gt;&lt;/span&gt;&lt;span&gt; String&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt;fromCharCode&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;(&lt;/span&gt;&lt;span&gt;byte&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;))&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt;join&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39;&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;             // ciphertext as string&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-8&quot;&gt;    const&lt;/span&gt;&lt;span&gt; ctBase64&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; =&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt; btoa&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;(&lt;/span&gt;&lt;span&gt;ctStr&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;                                                      // encode ciphertext as base64&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-8&quot;&gt;    const&lt;/span&gt;&lt;span&gt; ivHex&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; =&lt;/span&gt;&lt;span&gt; Array&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;(&lt;/span&gt;&lt;span&gt;iv&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;(&lt;/span&gt;&lt;span class=&quot; z-i&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt; =&amp;gt;&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; (&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;00&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39; +&lt;/span&gt;&lt;span&gt; b&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt;toString&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;16&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;))&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt;slice&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;))&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt;join&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39;&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;z-1 z-i&quot;&gt; // iv as hex string&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;    return&lt;/span&gt;&lt;span&gt; ivHex&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;+&lt;/span&gt;&lt;span&gt;ctBase64&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;                                                             // return iv+ciphertext&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-8&quot;&gt;async function&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt; aesGcmDecrypt&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;(&lt;/span&gt;&lt;span class=&quot; z-i&quot;&gt;ciphertext&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;,&lt;/span&gt;&lt;span class=&quot; z-i&quot;&gt; password&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;) {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-8&quot;&gt;    const&lt;/span&gt;&lt;span&gt; pwUtf8&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; = new&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt; TextEncoder&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt;encode&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;(&lt;/span&gt;&lt;span&gt;password&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;                                 // encode password as UTF-8&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-8&quot;&gt;    const&lt;/span&gt;&lt;span&gt; pwHash&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; =&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt; await&lt;/span&gt;&lt;span&gt; crypto&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span&gt;subtle&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt;digest&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;SHA-256&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39;,&lt;/span&gt;&lt;span&gt; pwUtf8&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;                      // hash the password&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-8&quot;&gt;    const&lt;/span&gt;&lt;span&gt; iv&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; =&lt;/span&gt;&lt;span&gt; ciphertext&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt;slice&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;24&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt;match&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;{2}/&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;g&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;(&lt;/span&gt;&lt;span class=&quot; z-i&quot;&gt;byte&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt; =&amp;gt;&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt; parseInt&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;(&lt;/span&gt;&lt;span&gt;byte&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 16&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;))&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;  // get iv from ciphertext&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-8&quot;&gt;    const&lt;/span&gt;&lt;span&gt; alg&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; = {&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; name&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;: &amp;#39;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;AES-GCM&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39;,&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; iv&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;: new&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt; Uint8Array&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;(&lt;/span&gt;&lt;span&gt;iv&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; };&lt;/span&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;                           // specify algorithm to use&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-8&quot;&gt;    const&lt;/span&gt;&lt;span&gt; key&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; =&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt; await&lt;/span&gt;&lt;span&gt; crypto&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span&gt;subtle&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt;importKey&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;raw&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39;,&lt;/span&gt;&lt;span&gt; pwHash&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;,&lt;/span&gt;&lt;span&gt; alg&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;z-11&quot;&gt; false&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; [&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;decrypt&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;])&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;z-1 z-i&quot;&gt; // use pw to generate key&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-8&quot;&gt;    const&lt;/span&gt;&lt;span&gt; ctStr&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; =&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt; atob&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;(&lt;/span&gt;&lt;span&gt;ciphertext&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt;slice&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;24&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;))&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;                                          // decode base64 ciphertext&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-8&quot;&gt;    const&lt;/span&gt;&lt;span&gt; ctUint8&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; = new&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt; Uint8Array&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;(&lt;/span&gt;&lt;span&gt;ctStr&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt;match&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;g&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;(&lt;/span&gt;&lt;span class=&quot; z-i&quot;&gt;ch&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt; =&amp;gt;&lt;/span&gt;&lt;span&gt; ch&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt;charCodeAt&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;)))&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;     // ciphertext as Uint8Array&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;    // note: why doesn&amp;#39;t ctUint8 = new TextEncoder().encode(ctStr) work?&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-8&quot;&gt;    const&lt;/span&gt;&lt;span&gt; plainBuffer&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; =&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt; await&lt;/span&gt;&lt;span&gt; crypto&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span&gt;subtle&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt;decrypt&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;(&lt;/span&gt;&lt;span&gt;alg&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;,&lt;/span&gt;&lt;span&gt; key&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;,&lt;/span&gt;&lt;span&gt; ctUint8&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;                // decrypt ciphertext using key&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-8&quot;&gt;    const&lt;/span&gt;&lt;span&gt; plaintext&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; = new&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt; TextDecoder&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt;decode&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;(&lt;/span&gt;&lt;span&gt;plainBuffer&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;                           // decode password from UTF-8&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;    return&lt;/span&gt;&lt;span&gt; plaintext&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;                                                                  // return the plaintext&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Backend code:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;package main&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;import (&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&amp;quot;bytes&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&amp;quot;crypto/aes&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&amp;quot;crypto/cipher&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&amp;quot;crypto/sha256&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&amp;quot;encoding/base64&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&amp;quot;encoding/hex&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&amp;quot;fmt&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&amp;quot;io&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&amp;quot;log&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;func main() {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	data := &amp;quot;e2f4b56b1961ca12d38031420DVbsv0o5Tux4MUCGG0ZcMUZ7yZHlSWn3DsZJmbg&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	message := bytes.Buffer{}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	iv, err := hex.DecodeString(data[:24])&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	if err != nil {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		log.Fatal(err)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	message.Write(iv)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	payload, err := base64.StdEncoding.DecodeString(data[24:])&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	if err != nil {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		fmt.Println(&amp;quot;decode error:&amp;quot;, err)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		return&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	message.Write(payload)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	h := sha256.New()&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	io.WriteString(h, &amp;quot;pw&amp;quot;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	key := h.Sum(nil)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	out, err := Decrypt(key, message.Bytes())&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	if err != nil {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		fmt.Println(&amp;quot;decode error:&amp;quot;, err)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		return&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	fmt.Printf(&amp;quot;message: %s\n&amp;quot;, out)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;// Decrypt AES-256 GCM&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;func Decrypt(password, message []byte) ([]byte, error) {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	c, err := aes.NewCipher(password)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	if err != nil {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		return nil, err&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	gcm, err := cipher.NewGCM(c)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	if err != nil {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		return nil, err&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	nonce := make([]byte, gcm.NonceSize())&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	copy(nonce, message[:gcm.NonceSize()])&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	out, err := gcm.Open(nil, nonce, message[gcm.NonceSize():], nil)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	if err != nil {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		return nil, err&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	return out, nil&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Example of web page &lt;code&gt;index.html&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;html&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;lt;!&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;DOCTYPE&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt; html&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;head&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    &amp;lt;&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;meta&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt; charset&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;UTF-8&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; /&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    &amp;lt;&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;meta&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt; name&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;viewport&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt; content&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;width=device-width&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; /&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    &amp;lt;&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span&gt;test webcrypto&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    &amp;lt;&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;script&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt; src&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;common.js&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;script&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    &amp;lt;&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;script&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;async&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt; =&amp;gt;&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-8&quot;&gt;            const&lt;/span&gt;&lt;span&gt; ciphertext&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; =&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt; await&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt; aesGcmEncrypt&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;my secret text&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;, &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;pw&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            out&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; =&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt; await&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt; aesGcmDecrypt&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;(&lt;/span&gt;&lt;span&gt;ciphertext&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;, &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;pw&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            console&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;(&lt;/span&gt;&lt;span&gt;ciphertext&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;,&lt;/span&gt;&lt;span&gt; out&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        }&lt;/span&gt;&lt;span&gt;)()&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    &amp;lt;/&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;script&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;head&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;body&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;check your console.log&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;body&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To test create a directory with &lt;code&gt;index.html&lt;/code&gt; and &lt;code&gt;common.js&lt;/code&gt; and execute command
&lt;a rel=&quot;external&quot; href=&quot;https://github.com/nbari/www&quot;&gt;www&lt;/a&gt;:&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Merge Terraform States</title>
        <published>2017-08-13T09:31:49+02:00</published>
        <updated>2017-08-13T09:31:49+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/merge-terraform-states/"/>
        <id>https://nbari.com/merge-terraform-states/</id>
        
        <content type="html" xml:base="https://nbari.com/merge-terraform-states/">&lt;p&gt;If states are being stored in S3, after importing a resource, for example:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ terraform import aws_customer_gateway.main cgw-b4dc3961&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You will end with a terraform.tfstate that differs from the one in the S3 bucket.&lt;/p&gt;
&lt;p&gt;To merge the remote and local state do this:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ terraform state pull &amp;gt; terraform.tfstate&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ terraform import aws_customer_gateway.main cgw-b4dc3961&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ terraform state push terraform.tfstate&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;First get the current s3 state:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ terraform state pull &amp;gt; terraform.tfstate&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then import what you need, for example:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ terraform import aws_customer_gateway.main cgw-b4dc3961&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then push back to s3 the state&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ terraform state push terraform.tfstate&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Terraform Full Vpc</title>
        <published>2017-08-12T04:07:54+02:00</published>
        <updated>2017-08-12T04:07:54+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/terraform-full-vpc/"/>
        <id>https://nbari.com/terraform-full-vpc/</id>
        
        <content type="html" xml:base="https://nbari.com/terraform-full-vpc/">&lt;p&gt;Example of a full &lt;a href=&quot;/post/aws-vpc/&quot;&gt;VPC&lt;/a&gt; setup using terraform, including VPN and using the default subnet:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;resource &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;aws_vpc&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;test&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  cidr_block           =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;10.100.0.0/16&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  enable_dns_hostnames =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  enable_dns_support   =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  tags {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Name =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;test&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;  }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;output &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;vpc_id&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  value =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;${aws_vpc.test.id}&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;resource &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;aws_internet_gateway&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;igw&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  vpc_id =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;${aws_vpc.test.id}&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  tags {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Name =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;internet gateway&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;  }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;resource &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;aws_subnet&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;public-a&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  vpc_id            =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;${aws_vpc.test.id}&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  cidr_block        =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;10.100.0.0/24&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  availability_zone =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;eu-central-1a&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  tags {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Name =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;public A&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;  }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;output &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;subnet-public-a&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  value =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;${aws_subnet.public-a.id}&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;resource &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;aws_subnet&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;public-b&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  vpc_id            =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;${aws_vpc.test.id}&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  cidr_block        =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;10.100.1.0/24&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  availability_zone =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;eu-central-1b&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  tags {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Name =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;public B&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;  }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;output &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;subnet-public-b&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  value =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;${aws_subnet.public-b.id}&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;resource &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;aws_subnet&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;public-c&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  vpc_id            =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;${aws_vpc.test.id}&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  cidr_block        =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;10.100.2.0/24&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  availability_zone =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;eu-central-1c&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  tags {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Name =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;public C&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;  }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;output &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;subnet-public-c&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  value =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;${aws_subnet.public-c.id}&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;resource &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;aws_subnet&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;private-a&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  vpc_id            =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;${aws_vpc.test.id}&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  cidr_block        =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;10.100.8.0/21&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  availability_zone =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;eu-central-1a&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  tags {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Name =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;private A&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;  }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;output &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;subnet-private-a&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  value =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;${aws_subnet.private-a.id}&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;resource &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;aws_subnet&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;private-b&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  vpc_id            =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;${aws_vpc.test.id}&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  cidr_block        =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;10.100.16.0/21&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  availability_zone =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;eu-central-1b&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  tags {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Name =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;private B&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;  }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;output &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;subnet-private-b&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  value =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;${aws_subnet.private-b.id}&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;resource &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;aws_subnet&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;private-c&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  vpc_id            =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;${aws_vpc.test.id}&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  cidr_block        =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;10.100.24.0/21&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  availability_zone =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;eu-central-1c&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  tags {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Name =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;private C&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;  }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;output &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;subnet-private-c&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  value =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;${aws_subnet.private-c.id}&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;resource &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;aws_default_route_table&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;public&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  default_route_table_id =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;${aws_vpc.test.default_route_table_id}&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  tags {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Name =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;Public&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;  }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;resource &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;aws_route&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;public&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  route_table_id         =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;${aws_vpc.test.default_route_table_id}&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  destination_cidr_block =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;0.0.0.0/0&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  gateway_id             =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;${aws_internet_gateway.igw.id}&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;resource &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;aws_route&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;public-vpn&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  route_table_id         =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;${aws_vpc.test.default_route_table_id}&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  depends_on             = [&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;aws_vpn_gateway.your-vpn&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  destination_cidr_block =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;10.13.0.0/16&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  gateway_id             =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;${aws_vpn_gateway.your-vpn.id}&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;resource &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;aws_eip&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;nat-eip&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  vpc        = true&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  depends_on = [&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;aws_internet_gateway.igw&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;resource &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;aws_nat_gateway&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;nat&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  allocation_id =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;${aws_eip.nat-eip.id}&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  subnet_id     =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;${aws_subnet.public-a.id}&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  depends_on    = [&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;aws_internet_gateway.igw&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;resource &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;aws_route_table&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;nat&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  vpc_id     =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;${aws_vpc.test.id}&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  depends_on = [&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;aws_internet_gateway.igw&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  tags {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Name =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;NAT&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;  }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;resource &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;aws_route&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;nat&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  route_table_id         =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;${aws_route_table.nat.id}&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  depends_on             = [&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;aws_route_table.nat&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  destination_cidr_block =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;0.0.0.0/0&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  nat_gateway_id         =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;${aws_nat_gateway.nat.id}&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;resource &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;aws_route&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;nat-vpn&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  route_table_id         =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;${aws_route_table.nat.id}&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  depends_on             = [&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;aws_route_table.nat&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;aws_vpn_gateway.your-vpn&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  destination_cidr_block =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;10.13.0.0/16&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  gateway_id             =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;${aws_vpn_gateway.your-vpn.id}&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;resource &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;aws_route_table_association&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;nat-a&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  subnet_id      =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;${aws_subnet.private-a.id}&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  route_table_id =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;${aws_route_table.nat.id}&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;resource &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;aws_route_table_association&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;nat-b&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  subnet_id      =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;${aws_subnet.private-b.id}&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  route_table_id =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;${aws_route_table.nat.id}&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;resource &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;aws_route_table_association&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;nat-c&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  subnet_id      =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;${aws_subnet.private-c.id}&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  route_table_id =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;${aws_route_table.nat.id}&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;resource &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;aws_route_table_association&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;public-a&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  subnet_id      =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;${aws_subnet.public-a.id}&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  route_table_id =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;${aws_vpc.test.default_route_table_id}&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;resource &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;aws_route_table_association&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;public-b&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  subnet_id      =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;${aws_subnet.public-b.id}&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  route_table_id =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;${aws_vpc.test.default_route_table_id}&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;resource &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;aws_route_table_association&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;public-c&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  subnet_id      =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;${aws_subnet.public-c.id}&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  route_table_id =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;${aws_vpc.test.default_route_table_id}&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;resource &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;aws_vpc_dhcp_options&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;test&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  domain_name         =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;test&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  domain_name_servers = [&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;AmazonProvidedDNS&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  netbios_node_type   = 2&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  tags {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Name =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;test&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;  }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;resource &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;aws_vpn_gateway&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;your-vpn&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  vpc_id =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;${aws_vpc.test.id}&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  tags {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Name =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;your-vpn gw&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;  }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;resource &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;aws_customer_gateway&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;your-vpn&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  bgp_asn    =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;65000&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ip_address =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;26.19.97.10&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  type       =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;ipsec.1&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  tags {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Name =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;your-vpn gateway&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;  }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;resource &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;aws_vpn_connection&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;your-vpn&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  vpn_gateway_id      =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;${aws_vpn_gateway.your-vpn.id}&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  customer_gateway_id =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;${aws_customer_gateway.your-vpn.id}&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  type                =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;ipsec.1&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  static_routes_only  = true&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  tags {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Name =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;your-vpn connection&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;  }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;resource &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;aws_vpn_connection_route&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;office&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  destination_cidr_block =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;10.13.0.0/16&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  vpn_connection_id      =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;${aws_vpn_connection.your-vpn.id}&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;resource &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;aws_default_security_group&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  vpc_id =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;${aws_vpc.test.id}&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ingress {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    from_port   = 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    to_port     = 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    protocol    =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;-1&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    cidr_blocks = [&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;0.0.0.0/0&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;  }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  egress &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    from_port   = 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    to_port     = 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    protocol    =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;-1&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    cidr_blocks = [&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;0.0.0.0/0&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;  }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  tags &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Name =&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;  }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Nginx Reverse Proxy Cache</title>
        <published>2017-08-10T17:51:52+02:00</published>
        <updated>2017-08-10T17:51:52+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/nginx-reverse-proxy-cache/"/>
        <id>https://nbari.com/nginx-reverse-proxy-cache/</id>
        
        <content type="html" xml:base="https://nbari.com/nginx-reverse-proxy-cache/">&lt;p&gt;This is the full configuration for &lt;code&gt;nginx.conf&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;nginx&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;user&lt;/span&gt;&lt;span&gt; www www&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;worker_processes&lt;/span&gt;&lt;span&gt;  auto&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-8&quot;&gt;events&lt;/span&gt;&lt;span&gt; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    use kqueue;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    worker_connections&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;  1024&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-8&quot;&gt;http&lt;/span&gt;&lt;span&gt; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    include&lt;/span&gt;&lt;span&gt;       mime.types&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    default_type&lt;/span&gt;&lt;span&gt;  application/octet-stream&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    sendfile on;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    tcp_nopush on;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    tcp_nodelay on;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    client_max_body_size&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 30M&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    keepalive_timeout&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;    10 10&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    gzip            on;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    gzip_static     on;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    gzip_vary       on;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    gzip_min_length&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 0&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    gzip_comp_level&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 9&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    gzip_buffers&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;    16 8k&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    gzip_proxied&lt;/span&gt;&lt;span&gt;    any&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    gzip_types&lt;/span&gt;&lt;span&gt; text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript application/json application/javascript image/svg+xml&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    charset&lt;/span&gt;&lt;span&gt;   utf-8&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    server_tokens off;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    server_name_in_redirect off;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    proxy_buffering    on;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    proxy_cache_path&lt;/span&gt;&lt;span&gt;   /home/cache levels=1:2 keys_zone=rubygems:256m max_size=5g inactive=24h use_temp_path=off&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    proxy_buffer_size&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;  8k&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    proxy_buffers&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;      8 24k&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-8&quot;&gt;    server&lt;/span&gt;&lt;span&gt; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        listen&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;       80&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        server_name&lt;/span&gt;&lt;span&gt;  _&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-8&quot;&gt;        location&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt; / &lt;/span&gt;&lt;span&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            proxy_cache&lt;/span&gt;&lt;span&gt; rubygems&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            proxy_cache_use_stale&lt;/span&gt;&lt;span&gt; updating &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;error&lt;/span&gt;&lt;span&gt; timeout invalid_header http_500 http_502 http_503 http_504&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            proxy_cache_revalidate on;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            proxy_cache_min_uses&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 1&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            proxy_cache_lock on;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            proxy_cache_valid&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 200 301 304 2d&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            proxy_ignore_headers&lt;/span&gt;&lt;span&gt; X-Accel-Expires Expires Cache-Control Set-Cookie&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            proxy_redirect off;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            proxy_set_header&lt;/span&gt;&lt;span&gt; X-Real-IP &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;$&lt;/span&gt;&lt;span&gt;remote_addr&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            proxy_set_header&lt;/span&gt;&lt;span&gt; X-Forwarded-For &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;$&lt;/span&gt;&lt;span&gt;proxy_add_x_forwarded_for&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            proxy_set_header&lt;/span&gt;&lt;span&gt; X-Forwarded-Proto &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;$&lt;/span&gt;&lt;span&gt;scheme&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            proxy_set_header&lt;/span&gt;&lt;span&gt; Host rubygems.org&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            proxy_set_header&lt;/span&gt;&lt;span&gt; Connection &lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            proxy_http_version&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 1.1&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            proxy_pass&lt;/span&gt;&lt;span&gt; https://rubygems.org/&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In this case Nginx is used to cache packages from &lt;a rel=&quot;external&quot; href=&quot;https://rubygems.org&quot;&gt;rubygems.org&lt;/a&gt;.&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Running Multiple Instances of The Same App In MacOS</title>
        <published>2017-07-30T16:31:35+02:00</published>
        <updated>2017-07-30T16:31:35+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/running-multiple-instances-of-the-same-app-in-macos/"/>
        <id>https://nbari.com/running-multiple-instances-of-the-same-app-in-macos/</id>
        
        <content type="html" xml:base="https://nbari.com/running-multiple-instances-of-the-same-app-in-macos/">&lt;p&gt;Open a terminal and type:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;open -n /Applications/ApplicationName.app&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Change &quot;ApplicationName&quot; with your application, example:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;open -n /Applications/PopcornTime.app&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Syslogd 8 bit</title>
        <published>2017-07-23T10:12:23+02:00</published>
        <updated>2017-07-23T10:12:23+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/syslogd-8-bit/"/>
        <id>https://nbari.com/syslogd-8-bit/</id>
        
        <content type="html" xml:base="https://nbari.com/syslogd-8-bit/">&lt;p&gt;If want to log full utf-8 strings &quot;emoji&#39;s&quot; use the option &lt;code&gt;-8&lt;/code&gt;, example on &lt;code&gt;/etc/rc.conf&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;syslogd_flags=&amp;quot;-ssC8&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The optiosn are:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; -s      Operate in secure mode.  Do not log messages from remote&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         machines.  If specified twice, no network socket will be opened&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         at all, which also disables logging to remote machines.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; -C      Create log files that do not exist (permission is set to 0600).&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; -8      Tells syslogd not to interfere with 8-bit data.  Normally syslogd&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         will replace C1 control characters (ISO 8859 and Unicode&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         characters) with their “M-x” equivalent.  Note, this option does&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         not change the way syslogd alters control characters (see&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         iscntrl(3)).  They will always be replaced with their “^x”&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         equivalent.&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Slave Is Running</title>
        <published>2017-07-19T14:54:35+02:00</published>
        <updated>2017-07-19T14:54:35+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/slave-is-running/"/>
        <id>https://nbari.com/slave-is-running/</id>
        
        <content type="html" xml:base="https://nbari.com/slave-is-running/">&lt;p&gt;Script to check if mysql replica (slave) is running:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;#!/bin/sh&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SLAVE_IS_RUNNING&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=$(&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;/usr/local/bin/mysql&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -e&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;SHOW SLAVE STATUS\G&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; |&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt; grep&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; Slave_SQL_Running:&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; |&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt; awk&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;#39;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;{print $2}&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; [ &amp;quot;&lt;/span&gt;&lt;span&gt;$SLAVE_IS_RUNNING&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; != &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;Yes&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; ]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;then&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;   # your options here&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;   /usr/local/bin/mysql&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -e&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;STOP SLAVE; SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; START SLAVE;&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;fi&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The username and password can be stored in a &lt;code&gt;.my.cnf&lt;/code&gt; file, for example in &lt;code&gt;/root/.my.cnf&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[client]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;user=dbadmin&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;password=secret&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Curl Response Time</title>
        <published>2017-06-28T18:11:20+02:00</published>
        <updated>2017-06-28T18:11:20+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/curl-response-time/"/>
        <id>https://nbari.com/curl-response-time/</id>
        
        <content type="html" xml:base="https://nbari.com/curl-response-time/">&lt;h1 id=&quot;measure-response-time-with-curl&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#measure-response-time-with-curl&quot; aria-label=&quot;Anchor link for: measure-response-time-with-curl&quot;&gt;🔗&lt;/a&gt;Measure response time with curl&lt;/h1&gt;
&lt;p&gt;Using the following command:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;curl -o /dev/null -s -w %{time_total}  http://www.google.com&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In your &lt;code&gt;.zshrc&lt;/code&gt; this can be used:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;curl_time&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;() {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;    curl&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -o /dev/null -Ls -w&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span&gt; \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;   time_namelookup:  %{time_namelookup}\n &lt;/span&gt;&lt;span&gt;\&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;      time_connect:  %{time_connect}\n &lt;/span&gt;&lt;span&gt;\&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;   time_appconnect:  %{time_appconnect}\n &lt;/span&gt;&lt;span&gt;\&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;  time_pretransfer:  %{time_pretransfer}\n &lt;/span&gt;&lt;span&gt;\&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;     time_redirect:  %{time_redirect}\n &lt;/span&gt;&lt;span&gt;\&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;time_starttransfer:  %{time_starttransfer}\n &lt;/span&gt;&lt;span&gt;\&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                   ----------\n &lt;/span&gt;&lt;span&gt;\&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;        time_total:  %{time_total}\n&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; &amp;quot;&lt;/span&gt;&lt;span class=&quot; z-i&quot;&gt;$1&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Will output something like:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ curl_time https://google.com&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    time_namelookup:  0.014&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;       time_connect:  0.024&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    time_appconnect:  0.072&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   time_pretransfer:  0.072&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      time_redirect:  0.000&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; time_starttransfer:  0.084&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    ----------&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         time_total:  0.084&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Get more datapoints:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ for i in {1..3}; curl -sL -w &amp;quot;%{time_total}\n&amp;quot; -o /dev/null  https://www.google.com&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>grpc</title>
        <published>2017-06-23T20:10:58+02:00</published>
        <updated>2017-06-23T20:10:58+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/grpc/"/>
        <id>https://nbari.com/grpc/</id>
        
        <content type="html" xml:base="https://nbari.com/grpc/">&lt;h1 id=&quot;what-is-grpc&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#what-is-grpc&quot; aria-label=&quot;Anchor link for: what-is-grpc&quot;&gt;🔗&lt;/a&gt;What is gRPC?&lt;/h1&gt;
&lt;p&gt;A remote procedure call
(&lt;a rel=&quot;external&quot; href=&quot;https://en.wikipedia.org/wiki/Remote_procedure_call&quot;&gt;RPC&lt;/a&gt;)
framework that by default uses
&lt;a rel=&quot;external&quot; href=&quot;https://developers.google.com/protocol-buffers/docs/overview&quot;&gt;protocol buffers&lt;/a&gt;
as the Interface Definition Language (IDL). One of the initial benefits is
the ability to be able to define and codify your service requirements via a
&lt;strong&gt;.proto&lt;/strong&gt; file.&lt;/p&gt;
&lt;p&gt;It uses HTTP/2 for transport but &lt;strong&gt;is not yet available for use within the
browser&lt;/strong&gt;, therefore currently mainly in use for Inter-Process Communication (IPC)
within microservices.&lt;/p&gt;
&lt;h1 id=&quot;the-workflow-to-create-a-grpc-service&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#the-workflow-to-create-a-grpc-service&quot; aria-label=&quot;Anchor link for: the-workflow-to-create-a-grpc-service&quot;&gt;🔗&lt;/a&gt;The workflow to create a gRPC service&lt;/h1&gt;
&lt;ol&gt;
&lt;li&gt;Create the service definition and payload structure in the &lt;code&gt;.proto&lt;/code&gt; file.&lt;/li&gt;
&lt;li&gt;Generate the gRPC code from the &lt;code&gt;.proto&lt;/code&gt; file.&lt;/li&gt;
&lt;li&gt;Implement the server in one of the supported languages.&lt;/li&gt;
&lt;li&gt;Create the client that invokes the service thought the Stub.&lt;/li&gt;
&lt;li&gt;Run the server and client(s).&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&quot;proto&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#proto&quot; aria-label=&quot;Anchor link for: proto&quot;&gt;🔗&lt;/a&gt;.proto&lt;/h3&gt;
&lt;p&gt;The first step when working with protocol buffers is to define the structure for
the data you want to serialize in a proto file: this is an ordinary text file
with a &lt;strong&gt;.proto&lt;/strong&gt; extension. Protocol buffer data is structured as messages,
where each message is a small logical record of information containing a series
of name-value pairs called fields. Here’s a simple example:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;message Person {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  string name = 1;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  int32 id = 2;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  bool has_ponycopter = 3;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Once you have your service defined, you can utilise a command line compiler to
generate stubs and code in multiple programming languages. So you can generate
a client and server with the Go programming language, and then using the same
&lt;strong&gt;.proto&lt;/strong&gt; file generate a client/server with Ruby.&lt;/p&gt;
&lt;h1 id=&quot;install-grpc&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#install-grpc&quot; aria-label=&quot;Anchor link for: install-grpc&quot;&gt;🔗&lt;/a&gt;Install gRPC&lt;/h1&gt;
&lt;p&gt;To install this package, you need to install Go and setup your Go workspace on
your computer. The simplest way to install the library is to run:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ go get -u google.golang.org/grpc&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Next, install the protoc plugin for Go:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ go get -u github.com/golang/protobuf/protoc-gen-go&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h1 id=&quot;hello-world-service-example&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#hello-world-service-example&quot; aria-label=&quot;Anchor link for: hello-world-service-example&quot;&gt;🔗&lt;/a&gt;Hello World service example&lt;/h1&gt;
&lt;p&gt;Example of a service definition &lt;code&gt;helloworld.proto&lt;/code&gt; using syntatx &lt;a rel=&quot;external&quot; href=&quot;https://developers.google.com/protocol-buffers/docs/proto3#specifying-field-types&quot;&gt;proto3&lt;/a&gt;&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;syntax = &amp;quot;proto3&amp;quot;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;package helloworld;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;// The greeting service definition.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;service Greeter {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  // Sends a greeting&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  rpc SayHello (HelloRequest) returns (HelloReply) {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;// The request message containing the user&amp;#39;s name.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;message HelloRequest {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  string name = 1;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;// The response message containing the greetings&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;message HelloReply {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  string message = 1;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;The package value is used (conveniently) as the name of the Go package, in this case &quot;helloworld&quot;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The service &lt;code&gt;Greeter&lt;/code&gt; exposes a method named &lt;code&gt;SayHello&lt;/code&gt; if you would like more
methods you could do something like this:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;// The greeting service definition.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;service Greeter {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  rpc SayHello (HelloRequest) returns (HelloReply) {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  rpc SayHelloAgain (HelloRequest) returns (HelloReply) {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now service &lt;code&gt;Greeter&lt;/code&gt; exposes method &lt;code&gt;SayHello&lt;/code&gt; and &lt;code&gt;SayHelloAgain&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id=&quot;syntax-explanation&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#syntax-explanation&quot; aria-label=&quot;Anchor link for: syntax-explanation&quot;&gt;🔗&lt;/a&gt;Syntax Explanation&lt;/h2&gt;
&lt;p&gt;Inside the &lt;code&gt;service&lt;/code&gt; statement &lt;code&gt;Greeter&lt;/code&gt; we state that we want a RPC service
that as a &lt;code&gt;SayHello&lt;/code&gt; method and that method accepts something of type
&lt;code&gt;HelloRequest&lt;/code&gt; and returns something of type &lt;code&gt;HelloReply&lt;/code&gt;. The &lt;code&gt;message&lt;/code&gt;
statement defines what &lt;code&gt;HelloRequest&lt;/code&gt; and &lt;code&gt;HelloReply&lt;/code&gt; look like.&lt;/p&gt;
&lt;p&gt;The numbers assigned to the property (e.g. both &lt;code&gt;name = 1&lt;/code&gt; and &lt;code&gt;message = 1&lt;/code&gt;)
are known as &#39;tags&#39;. Effectively, tags with a number between 1 and 15 take one
byte to encode where as tags between 16 and 2047 take two bytes to encode.
The idea is that you should reserve the tags 1 through 15 for very frequently
occurring message elements.&lt;/p&gt;
&lt;h1 id=&quot;create-the-code-protoc&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#create-the-code-protoc&quot; aria-label=&quot;Anchor link for: create-the-code-protoc&quot;&gt;🔗&lt;/a&gt;Create the code protoc&lt;/h1&gt;
&lt;p&gt;When using go you could keep this per repository in this case the package name
is &lt;code&gt;helloworld&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ cd $GOPATH/src/github.com/&amp;lt;your thing&amp;gt;/helloworld&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And then:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;protoc -I helloworld/ helloworld/helloworld.proto --go_out=plugins=grpc:helloworld&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This will create go code in a file named
&lt;a rel=&quot;external&quot; href=&quot;https://github.com/nbari/go-sandbox/blob/master/grpc/helloworld/helloworld.pb.go&quot;&gt;helloworld.pb.go&lt;/a&gt;
and can be used to create the
&lt;a rel=&quot;external&quot; href=&quot;https://github.com/nbari/go-sandbox/blob/master/grpc/server/main.go&quot;&gt;server&lt;/a&gt;
and
&lt;a rel=&quot;external&quot; href=&quot;https://github.com/nbari/go-sandbox/blob/master/grpc/client/main.go&quot;&gt;client&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&quot;when-should-you-use-rest&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#when-should-you-use-rest&quot; aria-label=&quot;Anchor link for: when-should-you-use-rest&quot;&gt;🔗&lt;/a&gt;When should you use REST?&lt;/h3&gt;
&lt;p&gt;If interoperability is your primary concern, nothing beats REST. There are no
special technologies needed, and you can leverage all of the widely deployed
infrastructure and tools that support the modern Web.&lt;/p&gt;
&lt;h3 id=&quot;when-should-you-use-rpc&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#when-should-you-use-rpc&quot; aria-label=&quot;Anchor link for: when-should-you-use-rpc&quot;&gt;🔗&lt;/a&gt;When should you use RPC?&lt;/h3&gt;
&lt;p&gt;If performance is your primary concern, RPC can provide an edge by leveraging
serialized data formats and alternative transport mechanisms.&lt;/p&gt;
&lt;div class=&quot;video-embed&quot;&gt;
    &lt;iframe src=&quot;https://www.youtube-nocookie.com/embed/XaMr--wAuSI&quot; title=&quot;YouTube video&quot; loading=&quot;lazy&quot; allow=&quot;accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen&gt;&lt;/iframe&gt;
&lt;/div&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>two factor authentication with ssh</title>
        <published>2017-06-03T15:21:40+02:00</published>
        <updated>2017-06-03T15:21:40+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/two-factor-authentication-with-ssh/"/>
        <id>https://nbari.com/two-factor-authentication-with-ssh/</id>
        
        <content type="html" xml:base="https://nbari.com/two-factor-authentication-with-ssh/">&lt;h1 id=&quot;two-factor-authentication-2fa-with-ssh&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#two-factor-authentication-2fa-with-ssh&quot; aria-label=&quot;Anchor link for: two-factor-authentication-2fa-with-ssh&quot;&gt;🔗&lt;/a&gt;Two-Factor-Authentication &quot;2FA&quot; with SSH&lt;/h1&gt;
&lt;p&gt;Install google authenticator and libqrencode:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pkg install pam_google_authenticator&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pkg install libqrencode&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Edit &lt;code&gt;/etc/pam.d/sshd&lt;/code&gt; an add the following line to the &lt;code&gt;auth&lt;/code&gt; section:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;# auth&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;auth&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;            sufficient      pam_opie.so             no_warn no_fake_prompts&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;auth&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;            requisite       pam_opieaccess.so       no_warn allow_local&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;#auth           sufficient      pam_krb5.so             no_warn try_first_pass&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;#auth           sufficient      pam_ssh.so              no_warn try_first_pass&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;#auth           required        pam_unix.so             no_warn try_first_pass&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;auth&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;            required        /usr/local/lib/pam_google_authenticator.so&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Add this to&lt;code&gt;/etc/ssh/sshd_config&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;CallengeResponseAuthentication yes&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;UsePAM yes&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;AuthenticationMethods publickey,keyboard-interactive&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This setup will do a &quot;publickey + verification code&quot;, without password, in
case you require password edit the &lt;code&gt;/etc/pam.d/sshd&lt;/code&gt; and ensure the line
&lt;code&gt;pam_unix.so&lt;/code&gt; is uncommented&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;auth           required        pam_unix.so             no_warn try_first_pass&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;auth           required        /usr/local/lib/pam_google_authenticator.so&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h1 id=&quot;enable-2fa-per-user&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#enable-2fa-per-user&quot; aria-label=&quot;Anchor link for: enable-2fa-per-user&quot;&gt;🔗&lt;/a&gt;Enable 2FA per user:&lt;/h1&gt;
&lt;p&gt;Execute google-authenticator as the user you want to protect with MFA:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;su - alice -c google-authenticator&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You can answer all questions to &lt;strong&gt;Y&lt;/strong&gt;, the configuration will be saved in this
file &lt;code&gt;~/.google-authenticator&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;The content of the file looks like this:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span&gt; cat .google_authenticator&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;VLS3WGLC4YTVFSSK&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;&amp;quot; TIME_SKEW 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; RESETTING_TIME_SKEW&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;&amp;quot; RATE_LIMIT 3 30 1496497256&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; WINDOW_SIZE&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 17&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;&amp;quot; DISALLOW_REUSE 49883227&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; TOTP_AUTH&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;12268625&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;67512245&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;75096563&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;52505947&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;42447122&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If for some reason the user can&#39;t scan the qrcode due the font issues, use the
code instead, in this example:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;VLS3WGLC4YTVFSSK&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>pdsh</title>
        <published>2017-06-03T15:05:03+02:00</published>
        <updated>2017-06-03T15:05:03+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/pdsh/"/>
        <id>https://nbari.com/pdsh/</id>
        
        <content type="html" xml:base="https://nbari.com/pdsh/">&lt;p&gt;pdsh - issue commands to groups of hosts in parallel&lt;/p&gt;
&lt;p&gt;Install:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;brew install pdsh&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Usage:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pdsh -R ssh -w ^servers.txt &amp;quot;&amp;lt;command&amp;gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In where &lt;code&gt;servers.txt&lt;/code&gt; is something like:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;10.8.4.2&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;10.8.4.3&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;10.8.4.4&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;one-liner:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pdsh -b -w &amp;quot;10.8.4.2, 10.8.4.3, 10.8.4.4&amp;quot; &amp;quot;&amp;lt;command&amp;gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;-b Disable ctrl-C status feature so that a single ctrl-C kills parallel job. (Batch Mode)&lt;/p&gt;
&lt;/blockquote&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>aws network acl</title>
        <published>2017-05-31T16:41:58+02:00</published>
        <updated>2017-05-31T16:41:58+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/aws-network-acl/"/>
        <id>https://nbari.com/aws-network-acl/</id>
        
        <content type="html" xml:base="https://nbari.com/aws-network-acl/">&lt;h1 id=&quot;aws-network-acl-deny-rule&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#aws-network-acl-deny-rule&quot; aria-label=&quot;Anchor link for: aws-network-acl-deny-rule&quot;&gt;🔗&lt;/a&gt;AWS network ACL deny rule&lt;/h1&gt;
&lt;p&gt;To block full access from an list of IP&#39;s within AWS:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; count=&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt; for&lt;/span&gt;&lt;span&gt; i&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt; in&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; `&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;cat&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; ips.txt&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;`&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;count&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=$((&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;count&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; +&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 1&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;)) &amp;amp;&amp;amp;&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt; aws&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; ec2 create-network-acl-entry --network-acl-id acl-XXXXXXXX --ingress --rule-number&lt;/span&gt;&lt;span&gt; $count&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; --protocol all --port-range From=0,To=&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;65535&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; --cidr-block&lt;/span&gt;&lt;span&gt; $i&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;/32 --rule-action deny&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In where &lt;code&gt;ips.txt&lt;/code&gt; is a file containing the IP addresses, for example:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;169.254.2.2&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;169.254.1.2&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;...&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h1 id=&quot;warning&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#warning&quot; aria-label=&quot;Anchor link for: warning&quot;&gt;🔗&lt;/a&gt;WARNING&lt;/h1&gt;
&lt;p&gt;The default limit for a single network ACL rules set by AWS is 20 for ingress
and 20 for egress rules including the default rules. The network ACL should not
be used as a Firewall, depending on the use case is better to use a CDN, WAF,
vm-firewall, etc.&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>haproxy ssh</title>
        <published>2017-05-30T14:47:06+02:00</published>
        <updated>2017-05-30T14:47:06+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/haproxy-ssh/"/>
        <id>https://nbari.com/haproxy-ssh/</id>
        
        <content type="html" xml:base="https://nbari.com/haproxy-ssh/">&lt;h1 id=&quot;https-and-ssh-on-the-same-port&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#https-and-ssh-on-the-same-port&quot; aria-label=&quot;Anchor link for: https-and-ssh-on-the-same-port&quot;&gt;🔗&lt;/a&gt;HTTPS and SSH on the same port&lt;/h1&gt;
&lt;p&gt;Using HAProxy to server SSH and SSL available on the same port:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;global&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    maxconn 1000000&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    spread-checks 3&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    log /var/run/log local0 notice&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    daemon&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    tune.ssl.default-dh-param 2048&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;defaults&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    mode http&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    balance roundrobin&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    option http-server-close&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    option abortonclose&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    option dontlognull&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    option redispatch&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    timeout check           3s&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    timeout client          30s  # Client and server timeout must match the longest&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    timeout connect         5s&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    timeout http-keep-alive 5s&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    timeout http-request    10s  # A complete request may never take that long.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    timeout queue           1m   # Don&amp;#39;t queue requests too long if saturated.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    timeout server          10s  # Time we may wait for a response from the server.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    retries 3&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    log global&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# ----------------------------------------------------------------------------&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# stats&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# ----------------------------------------------------------------------------&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;listen stats&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bind *:81&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    stats enable&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    stats uri /&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    stats show-node&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    stats show-legends&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    stats refresh 5s&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# ------------------------------------------------------------------------------&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;#  https + ssh&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# ------------------------------------------------------------------------------&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;frontend ssl&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    mode tcp&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bind *:443 ssl crt /usr/local/etc/haproxy/your.cert&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    option tcplog&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    tcp-request inspect-delay 5s&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    tcp-request content accept if HTTP&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # 5353482d322e30 is the binary representation of the string &amp;#39;SSH-2.0&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    acl client_attempts_ssh payload(0,7) -m bin 5353482d322e30&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    use_backend ssh if !HTTP&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    use_backend ssh if client_attempts_ssh&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    use_backend http if HTTP&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;backend http&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    mode http&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    http-request set-header X-Forwarded-Port %[dst_port]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    server www 10.10.8.3:8000 maxconn 50 check&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;backend ssh&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    mode tcp&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    option tcplog&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    server ssh 10.10.8.4:22&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    timeout server 2h&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h1 id=&quot;connecting-from-an-ssh-client&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#connecting-from-an-ssh-client&quot; aria-label=&quot;Anchor link for: connecting-from-an-ssh-client&quot;&gt;🔗&lt;/a&gt;Connecting from an SSH client&lt;/h1&gt;
&lt;p&gt;To connect throught the HAProxy on port 443 edit the ~/.ssh/config:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;Host&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; ssh-over-https&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;    ProxyCommand&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; openssl s_client -connect your.haproxy.com:443 -quiet&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h1 id=&quot;how-does-this-work&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#how-does-this-work&quot; aria-label=&quot;Anchor link for: how-does-this-work&quot;&gt;🔗&lt;/a&gt;how does this work ?&lt;/h1&gt;
&lt;p&gt;The &lt;a rel=&quot;external&quot; href=&quot;https://tools.ietf.org/html/rfc4253#section-4.2&quot;&gt;RFC 4253&lt;/a&gt;, section 4.2
states that clients must send a string that starts with &#39;SSH-2.0&#39;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;4.2.  Protocol Version Exchange&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   When the connection has been established, both sides MUST send an&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   identification string.  This identification string MUST be&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      SSH-protoversion-softwareversion SP comments CR LF&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   Since the protocol being defined in this set of documents is version&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   2.0, the &amp;#39;protoversion&amp;#39; MUST be &amp;quot;2.0&amp;quot;.&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;5353482d322e30&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;.&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt;decode&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;(&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;hex&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;SSH-2.0&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;5353482d322e30&lt;/code&gt; is the binary representation of the string &#39;SSH-2.0&#39;. So
everything boils down to this line:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;acl client_attempts_ssh payload(0,7) -m bin 5353482d322e30&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;When a new connection is made on the port 443, HAproxy decrypts the SSL layer,
and checks whether the stream of data sent by the client starts with this string.&lt;/p&gt;
&lt;p&gt;src: http://blog.chmd.fr/ssh-over-ssl-episode-4-a-haproxy-based-configuration.html&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>aws meta data</title>
        <published>2017-05-30T10:38:36+02:00</published>
        <updated>2017-05-30T10:38:36+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/aws-meta-data/"/>
        <id>https://nbari.com/aws-meta-data/</id>
        
        <content type="html" xml:base="https://nbari.com/aws-meta-data/">&lt;h1 id=&quot;aws-meta-data&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#aws-meta-data&quot; aria-label=&quot;Anchor link for: aws-meta-data&quot;&gt;🔗&lt;/a&gt;AWS meta-data&lt;/h1&gt;
&lt;p&gt;Instance metadata is data about your instance that you can use to configure or
manage the running instance. Instance metadata is divided into categories. For
more information, see &lt;a rel=&quot;external&quot; href=&quot;http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html#instancedata-data-categories&quot;&gt;Instance Metadata Categories.&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;To view all the categories:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;curl http://169.254.169.254/latest/meta-data/&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To obtain the private IP address:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;curl http://169.254.169.254/latest/meta-data/local-ipv4&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To obtain the public IP address:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;curl http://169.254.169.254/latest/meta-data/public-ipv4&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To obtain the ssh public key:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;curl http://169.254.169.254/1.0/meta-data/public-keys/0/openssh-key&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To obtain the instance name:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;curl http://169.254.169.254/latest/meta-data/instance-id&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To obtain the availability-zone:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;curl http://169.254.169.254/latest/meta-data/placement/availability-zone&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h1 id=&quot;169-254-16&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#169-254-16&quot; aria-label=&quot;Anchor link for: 169-254-16&quot;&gt;🔗&lt;/a&gt;169.254/16&lt;/h1&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://en.wikipedia.org/wiki/Link-local_address&quot;&gt;Link-local address&lt;/a&gt;
In a computer network, a link-local address is a network address that is valid
only for communications within the network segment (link) or the broadcast
domain that the host is connected to. Link-local addresses are not guaranteed
to be unique beyond a single network segment. Routers therefore do not forward
packets with link-local addresses. For protocols that have only link-local
addresses, such as Ethernet, hardware addresses assigned by manufacturers in
networking elements are unique, consisting of a vendor identification and a
serial identifier. Link-local addresses for IPv4 are defined in the address
block 169.254.0.0/16 in CIDR notation. In IPv6, they are assigned the address
block fe80::/64.[1]&lt;/p&gt;
&lt;p&gt;See &lt;a rel=&quot;external&quot; href=&quot;https://tools.ietf.org/html/rfc3927&quot;&gt;Dynamic Configuration of IPv4 Link-Local Addresses&lt;/a&gt;
This document describes how a host may automatically configure an interface with
an IPv4 address within the 169.254/16 prefix that is valid for communication
with other devices connected to the same physical (or logical) link.&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>mount nfs</title>
        <published>2017-05-28T20:26:20+02:00</published>
        <updated>2017-05-28T20:26:20+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/mount-nfs/"/>
        <id>https://nbari.com/mount-nfs/</id>
        
        <content type="html" xml:base="https://nbari.com/mount-nfs/">&lt;p&gt;To avoid hanging out the system while mounting &lt;code&gt;NFS&lt;/code&gt; shares on boot time add the
option &lt;code&gt;bg&lt;/code&gt; to the &lt;code&gt;/etc/fstab&lt;/code&gt;, example:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;192.168.1.2:/4T /plex/4T        nfs     rw,bg      0       0&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This will help to boot and in background continue trying to mount in case of getting a &quot;time out&quot;&lt;/p&gt;
&lt;p&gt;From the man page: &lt;code&gt;mount_nfs&lt;/code&gt;&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;bg      If an initial attempt to contact the server fails, fork&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        off a child to keep trying the mount in the background.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        Useful for fstab(5), where the file system mount is not&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        critical to multiuser operation.&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>aax2m4b</title>
        <published>2017-05-20T18:53:19+02:00</published>
        <updated>2017-05-20T18:53:19+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/aax2m4b/"/>
        <id>https://nbari.com/aax2m4b/</id>
        
        <content type="html" xml:base="https://nbari.com/aax2m4b/">&lt;p&gt;Convert an audiobook &lt;code&gt;.aax&lt;/code&gt; to &lt;code&gt;.m4b&lt;/code&gt; using ffmpeg&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;brew&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; install chromedriver ffmpeg&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; easy_install pip&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;pip&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; install selenium requests&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; clone https://github.com/inAudible-NG/audible-activator&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;cd&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; audible-activator&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;sed&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -i&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;#39;&amp;#39; &amp;#39;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;s,chromedriver_path = &amp;quot;./chromedriver&amp;quot;,chromedriver_path = &amp;quot;/usr/local/bin/chromedriver&amp;quot;,&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; audible-activator.py&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;./audible-activator.py&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;When running &lt;code&gt;audible-activator.py&lt;/code&gt; It will ask for the audible
username/password it will open chrome, and when finish print the activation
bytes:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; ./audible-activator.py&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;Username:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; your@email&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;Password:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;[*]&lt;/span&gt;&lt;span&gt; Player ID is 1xmjyl5rSw0yVb/olWBYuU/NBxk&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;activation_bytes:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; b97f4709&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;One having the activation_bytes, use ffmpeg:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ffmpeg -activation_bytes b97f4709 -i input.aax -vn -c:a copy output.m4a;mv output.m4{a,b}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;More info: https://apple.stackexchange.com/a/243670/104123&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>tmux ssh</title>
        <published>2017-05-19T22:03:43+02:00</published>
        <updated>2017-05-19T22:03:43+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/tmux-ssh/"/>
        <id>https://nbari.com/tmux-ssh/</id>
        
        <content type="html" xml:base="https://nbari.com/tmux-ssh/">&lt;h1 id=&quot;tmux-multiple-ssh-connections-with-synchronized-panels&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#tmux-multiple-ssh-connections-with-synchronized-panels&quot; aria-label=&quot;Anchor link for: tmux-multiple-ssh-connections-with-synchronized-panels&quot;&gt;🔗&lt;/a&gt;Tmux multiple ssh connections with synchronized panels&lt;/h1&gt;
&lt;p&gt;If need to debug/check in real-time multiple servers via ssh, this can be used.&lt;/p&gt;
&lt;h1 id=&quot;tmux-script&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#tmux-script&quot; aria-label=&quot;Anchor link for: tmux-script&quot;&gt;🔗&lt;/a&gt;tmux script&lt;/h1&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;#!/bin/sh&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;TARGET&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;tmux-ssh&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SSH_USER&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;devops&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;i&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;while&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt; read&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; line&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;do&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;    if&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; [&lt;/span&gt;&lt;span&gt; $i&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; ==&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 0&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; ]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;    then&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;        tmux&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; new-window -a -n&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; ${&lt;/span&gt;&lt;span&gt;TARGET&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;} &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;ssh -l &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;${&lt;/span&gt;&lt;span&gt;SSH_USER&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;} ${&lt;/span&gt;&lt;span&gt;line&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;    else&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;        tmux&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; split-window -t&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;${&lt;/span&gt;&lt;span&gt;TARGET&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;}&amp;quot; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;ssh -l &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;${&lt;/span&gt;&lt;span&gt;SSH_USER&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;} ${&lt;/span&gt;&lt;span&gt;line&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;}&amp;quot; &amp;amp;&amp;amp;&lt;/span&gt;&lt;span&gt; \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;            tmux&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; select-layout -t&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;${&lt;/span&gt;&lt;span&gt;TARGET&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;}&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; tiled&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;    fi&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;    let&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; i++&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;done&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;lt; &amp;quot;&lt;/span&gt;&lt;span class=&quot; z-i&quot;&gt;${1&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;:-/&lt;/span&gt;&lt;span&gt;dev&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;/&lt;/span&gt;&lt;span&gt;stdin&lt;/span&gt;&lt;span class=&quot; z-i&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;tmux&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; set-window-option -t&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; ${&lt;/span&gt;&lt;span&gt;TARGET&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; synchronize-panes on&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&quot;hosts&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#hosts&quot; aria-label=&quot;Anchor link for: hosts&quot;&gt;🔗&lt;/a&gt;hosts&lt;/h3&gt;
&lt;p&gt;If the input is json, &lt;a rel=&quot;external&quot; href=&quot;https://stedolan.github.io/jq/&quot;&gt;jq&lt;/a&gt; can be used to
extract hosts, assuming your output is similar to:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;  &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;serverA&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;: &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;hosts&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;: [&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;      &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;127.20.23.24&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;      &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;127.20.12.37&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;      &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;127.50.10.21&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;      &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;127.50.13.20&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    ]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;  }&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;  &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;serverB&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;: &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;hosts&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;: [&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;      &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;127.20.23.116&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;      &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;127.50.10.39&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    ]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;  }&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;  &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;serverC&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;: &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-8&quot;&gt;hosts&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;: [&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;      &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;127.20.8.9&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;      &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;127.50.16.130&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    ]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;  }&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To get only the hosts and ssh into them you could do something like:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cat hosts | jq &amp;quot;.serverA.hosts[]&amp;quot; -r | tmux-ssh.sh&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>beanstalkd</title>
        <published>2017-05-18T20:14:57+02:00</published>
        <updated>2017-05-18T20:14:57+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/beanstalkd/"/>
        <id>https://nbari.com/beanstalkd/</id>
        
        <content type="html" xml:base="https://nbari.com/beanstalkd/">&lt;h1 id=&quot;beanstalkd&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#beanstalkd&quot; aria-label=&quot;Anchor link for: beanstalkd&quot;&gt;🔗&lt;/a&gt;Beanstalkd&lt;/h1&gt;
&lt;p&gt;Beanstalkd is a big to-do list for your distributed application. If there
is a unit of work that you want to defer to later (say, sending an email,
pushing some data to a slow external service, pulling data from a slow external
service, generating high-quality image thumbnails) you put a description of that
work, a “job”, into beanstalkd. Some processes (such as web request handlers),
“producers”, put jobs into the queue. Other processes, “workers”, take jobs out
of the queue and run them. https://github.com/kr/beanstalkd/wiki/FAQ&lt;/p&gt;
&lt;h3 id=&quot;high-availability&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#high-availability&quot; aria-label=&quot;Anchor link for: high-availability&quot;&gt;🔗&lt;/a&gt;High availability&lt;/h3&gt;
&lt;p&gt;Put the instances behind a load balancer, &lt;a rel=&quot;external&quot; href=&quot;http://www.haproxy.org/&quot;&gt;HAProxy&lt;/a&gt; and
run beanstalk with option &lt;code&gt;-b&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;beanstalkd -b /home/beanstalkd/queue&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;/home/beanstalkd/queue needs to be an existing directory&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The option &lt;code&gt;-b&lt;/code&gt; will write all jobs to a binlog, if the power goes out, you can
restart beasntalkd with the same option and it will recover the contents of the
log.&lt;/p&gt;
&lt;h3 id=&quot;immortalizing-beanstalkd&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#immortalizing-beanstalkd&quot; aria-label=&quot;Anchor link for: immortalizing-beanstalkd&quot;&gt;🔗&lt;/a&gt;immortalizing beanstalkd&lt;/h3&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;cmd&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; beanstalkd -V -b /home/beanstalkd/queue&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;  file&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; /var/log/beanstalkd.log&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;  age&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 86400&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;  num&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 7&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;  size&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 1&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&quot;port-11300&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#port-11300&quot; aria-label=&quot;Anchor link for: port-11300&quot;&gt;🔗&lt;/a&gt;port 11300&lt;/h3&gt;
&lt;p&gt;Beanstalkd by default listen on port 11300&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>mysql db size</title>
        <published>2017-05-07T16:13:29+02:00</published>
        <updated>2017-05-07T16:13:29+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/mysql-db-size/"/>
        <id>https://nbari.com/mysql-db-size/</id>
        
        <content type="html" xml:base="https://nbari.com/mysql-db-size/">&lt;p&gt;How big is your data:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;sql&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-10&quot;&gt;SELECT IFNULL&lt;/span&gt;&lt;span&gt;(B.engine,&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;Total&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span&gt;) &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;Storage Engine&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;CONCAT&lt;/span&gt;&lt;span&gt;(LPAD(&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt;REPLACE&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt;FORMAT&lt;/span&gt;&lt;span&gt;(B.DSize&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt;POWER&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;1024&lt;/span&gt;&lt;span&gt;,pw),&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;3&lt;/span&gt;&lt;span&gt;),&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39;&amp;#39;&lt;/span&gt;&lt;span&gt;),&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;17&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39; &amp;#39;&lt;/span&gt;&lt;span&gt;),&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39; &amp;#39;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SUBSTR(&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; KMGTP&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span&gt;,pw&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;1&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;1&lt;/span&gt;&lt;span&gt;),&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;B&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span&gt;) &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;Data Size&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt;CONCAT&lt;/span&gt;&lt;span&gt;(LPAD(&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt;REPLACE&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;FORMAT&lt;/span&gt;&lt;span&gt;(B.ISize&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt;POWER&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;1024&lt;/span&gt;&lt;span&gt;,pw),&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;3&lt;/span&gt;&lt;span&gt;),&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39;&amp;#39;&lt;/span&gt;&lt;span&gt;),&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;17&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39; &amp;#39;&lt;/span&gt;&lt;span&gt;),&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39; &amp;#39;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SUBSTR(&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; KMGTP&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span&gt;,pw&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;1&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;1&lt;/span&gt;&lt;span&gt;),&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;B&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span&gt;) &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;Index Size&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt;CONCAT&lt;/span&gt;&lt;span&gt;(LPAD(&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt;REPLACE&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;FORMAT&lt;/span&gt;&lt;span&gt;(B.TSize&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt;POWER&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;1024&lt;/span&gt;&lt;span&gt;,pw),&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;3&lt;/span&gt;&lt;span&gt;),&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39;&amp;#39;&lt;/span&gt;&lt;span&gt;),&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;17&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39; &amp;#39;&lt;/span&gt;&lt;span&gt;),&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39; &amp;#39;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SUBSTR(&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; KMGTP&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span&gt;,pw&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;1&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;1&lt;/span&gt;&lt;span&gt;),&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;B&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span&gt;) &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;Table Size&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; FROM&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;SELECT&lt;/span&gt;&lt;span&gt; engine,&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt;SUM&lt;/span&gt;&lt;span&gt;(data_length) DSize,&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt;SUM&lt;/span&gt;&lt;span&gt;(index_length) ISize,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;SUM&lt;/span&gt;&lt;span&gt;(data_length&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;+&lt;/span&gt;&lt;span&gt;index_length) TSize &lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;FROM&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;information_schema.tables&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; WHERE&lt;/span&gt;&lt;span&gt; table_schema &lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;NOT IN&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;mysql&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;information_schema&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;performance_schema&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span&gt;) &lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;AND&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;engine &lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;IS NOT NULL GROUP BY&lt;/span&gt;&lt;span&gt; engine &lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;WITH ROLLUP&lt;/span&gt;&lt;span&gt;) B,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;SELECT 3&lt;/span&gt;&lt;span&gt; pw) A &lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;ORDER BY&lt;/span&gt;&lt;span&gt; TSize;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This will print something like:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;sql&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;----------------+----------------------+----------------------+----------------------+&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;| Storage Engine | &lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;Data Size&lt;/span&gt;&lt;span&gt;            | &lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;Index Size&lt;/span&gt;&lt;span&gt;           | &lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;Table Size&lt;/span&gt;&lt;span&gt;           |&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;----------------+----------------------+----------------------+----------------------+&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;| InnoDB         |            &lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;10&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;412&lt;/span&gt;&lt;span&gt; GB |             &lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;2&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;917&lt;/span&gt;&lt;span&gt; GB |            &lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;13&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;330&lt;/span&gt;&lt;span&gt; GB |&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;| Total          |            &lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;10&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;412&lt;/span&gt;&lt;span&gt; GB |             &lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;2&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;917&lt;/span&gt;&lt;span&gt; GB |            &lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;13&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;330&lt;/span&gt;&lt;span&gt; GB |&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;----------------+----------------------+----------------------+----------------------+&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-10&quot;&gt;2 rows in set&lt;/span&gt;&lt;span&gt; (&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;0&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;06&lt;/span&gt;&lt;span&gt; sec)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To get size of databases:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;sql&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-10&quot;&gt;SELECT&lt;/span&gt;&lt;span&gt; table_schema                                        &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;DB Name&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;   Round&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt;Sum&lt;/span&gt;&lt;span&gt;(data_length &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;+&lt;/span&gt;&lt;span&gt; index_length) &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 1024&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; /&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 1024&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;1&lt;/span&gt;&lt;span&gt;) &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;DB Size in MB&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-10&quot;&gt;   FROM&lt;/span&gt;&lt;span&gt;   information_schema.tables&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-10&quot;&gt;   GROUP  BY&lt;/span&gt;&lt;span&gt; table_schema;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Get usage and free size available:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;sql&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-10&quot;&gt;SELECT&lt;/span&gt;&lt;span&gt; table_schema &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;Data Base Name&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;sum&lt;/span&gt;&lt;span&gt;( data_length &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;+&lt;/span&gt;&lt;span&gt; index_length ) &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 1024&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; /&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-10&quot;&gt;1024&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;Data Base Size in MB&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;sum&lt;/span&gt;&lt;span&gt;( data_free )&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 1024&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; /&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 1024&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;Free Space in MB&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-10&quot;&gt;FROM&lt;/span&gt;&lt;span&gt; information_schema.TABLES&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-10&quot;&gt;GROUP BY&lt;/span&gt;&lt;span&gt; table_schema;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>raw2vmdk</title>
        <published>2017-04-30T21:43:24+02:00</published>
        <updated>2017-04-30T21:43:24+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/raw2vmdk/"/>
        <id>https://nbari.com/raw2vmdk/</id>
        
        <content type="html" xml:base="https://nbari.com/raw2vmdk/">&lt;h1 id=&quot;convert-raw-image-to-vmdk&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#convert-raw-image-to-vmdk&quot; aria-label=&quot;Anchor link for: convert-raw-image-to-vmdk&quot;&gt;🔗&lt;/a&gt;Convert raw image to vmdk&lt;/h1&gt;
&lt;p&gt;Install qemu:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ brew install qemu&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Convert using:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ qemu-img convert -f raw -O vmdk disk.raw disk.vmdk&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>brew update formula</title>
        <published>2017-04-30T12:40:49+02:00</published>
        <updated>2017-04-30T12:40:49+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/brew-update-formula/"/>
        <id>https://nbari.com/brew-update-formula/</id>
        
        <content type="html" xml:base="https://nbari.com/brew-update-formula/">&lt;p&gt;Example:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; brew bump-formula-pr --strict --url https://github.com/immortal/immortal/archive/0.24.2.tar.gz immortal&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;it will need an API GIT token: export HOMEBREW_GITHUB_API_TOKEN=XXXXX&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;To keep in sync forked repo:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;git fetch upstream&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;git co upstream/master&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;git push -f origin master&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>bastion ssh</title>
        <published>2017-04-28T11:57:07+02:00</published>
        <updated>2017-04-28T11:57:07+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/bastion-ssh/"/>
        <id>https://nbari.com/bastion-ssh/</id>
        
        <content type="html" xml:base="https://nbari.com/bastion-ssh/">&lt;h1 id=&quot;proxyjump&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#proxyjump&quot; aria-label=&quot;Anchor link for: proxyjump&quot;&gt;🔗&lt;/a&gt;ProxyJump&lt;/h1&gt;
&lt;p&gt;This is the easiest (new) way:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Host 10.*&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ProxyJump user@bastion.tld:2222&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;using-proxycommand&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#using-proxycommand&quot; aria-label=&quot;Anchor link for: using-proxycommand&quot;&gt;🔗&lt;/a&gt;Using ProxyCommand&lt;/h2&gt;
&lt;p&gt;Replace &lt;code&gt;your.bastion.tld&lt;/code&gt; with your bastion server and set your bastion
username in the &lt;code&gt;ProxyCommand&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Host bastion&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Hostname your.bastion.tld&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ForwardAgent yes&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Host 10.10.*&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ProxyCommand ssh &amp;lt;your-username&amp;gt;@bastion -W %h:%p&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;example&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#example&quot; aria-label=&quot;Anchor link for: example&quot;&gt;🔗&lt;/a&gt;example&lt;/h2&gt;
&lt;p&gt;To login with user devops to server 10.10.3.4:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ ssh -l devops 10.10.3.4&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;or&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ ssh devops@10.10.3.4&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h1 id=&quot;ssh-sockets&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#ssh-sockets&quot; aria-label=&quot;Anchor link for: ssh-sockets&quot;&gt;🔗&lt;/a&gt;SSH sockets&lt;/h1&gt;
&lt;p&gt;To speed up more when using the bastion host things this can be added at the  top of the &lt;code&gt;~/.ssh/config&lt;/code&gt; file:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ControlPath ~/.ssh/sockets/%r@%h:%p&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ControlMaster auto&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ControlPersist 10m&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;You need to create the sockets dir: &lt;code&gt;mkdir ~/.ssh/sockets&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Or you could add it per bastion configuration:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Host bastion&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Hostname your.bastion.tld&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ForwardAgent yes&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ControlPath ~/.ssh/sockets/%r@%h:%p&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ControlMaster auto&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ControlPersist 10m&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;ControlPath&lt;/code&gt; entry specifies where to store the “control socket” for the multiplexed connections. In this case, %r refers to the remote login name, %h refers to the target host name, and %p refers to the destination port.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;ControlMaster&lt;/code&gt; setting is what activates multiplexing. With the auto setting, SSH will try to use a master connection if one exists, but if one doesn’t exist it will create a new one&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;ControlPersist&lt;/code&gt; setting keeps the master connection alive for the specified period of time after it has remained idle (no connections). After that time, the master connection will be closed. In this example, we’ve specified that the master connection should remain open for 10 minutes after becoming idle. Subsequent SSH sessions made while the master connection is open will leverage the master connection and will reset the idle timer.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h1 id=&quot;check-the-status-of-multiplexing&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#check-the-status-of-multiplexing&quot; aria-label=&quot;Anchor link for: check-the-status-of-multiplexing&quot;&gt;🔗&lt;/a&gt;Check the status of multiplexing&lt;/h1&gt;
&lt;p&gt;Use the &lt;code&gt;-O &amp;lt;option&amp;gt;&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ ssh -O check user@host.tld&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Master running (pid=32015)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To stop multiplexed connections:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ ssh -O stop user@host.tld&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To exit and remove the control socket besides terminating all existing connections:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ ssh -O exit user@host.tld&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>smarthost</title>
        <published>2017-04-26T10:38:23+02:00</published>
        <updated>2017-04-26T10:38:23+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/smarthost/"/>
        <id>https://nbari.com/smarthost/</id>
        
        <content type="html" xml:base="https://nbari.com/smarthost/">&lt;h1 id=&quot;smarthost-with-postfix&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#smarthost-with-postfix&quot; aria-label=&quot;Anchor link for: smarthost-with-postfix&quot;&gt;🔗&lt;/a&gt;Smarthost with postfix&lt;/h1&gt;
&lt;blockquote&gt;
&lt;p&gt;A smart host is a type of email message transfer agent that allows a Simple
Mail Transfer Protocol (SMTP) server to route email to an intermediate
mailserver rather than directly to the recipient&#39;s server&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;https://en.wikipedia.org/wiki/Smart_host&lt;/p&gt;
&lt;p&gt;Setup postfix to forward all emails using an external SMTP server, for example
sendgrid.net, &lt;code&gt;main.cf&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;smtp_sasl_auth_enable = yes&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;smtp_sasl_password_maps = static:username:password&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;smtp_sasl_security_options = noanonymous&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;smtp_tls_security_level = encrypt&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;header_size_limit = 4096000&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;relayhost = [smtp.sendgrid.net]:587&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Within a VPC or private network you can open relay to all your class:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mynetworks_style = class&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Some tunings:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;smtp_connect_timeout = 5&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;smtp_helo_timeout = 5&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;disable_dns_lookups = yes&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To check list of queued mail:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;postqueue -p&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>mtr</title>
        <published>2017-04-25T17:52:37+02:00</published>
        <updated>2017-04-25T17:52:37+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/mtr/"/>
        <id>https://nbari.com/mtr/</id>
        
        <content type="html" xml:base="https://nbari.com/mtr/">&lt;h1 id=&quot;mtr-to-create-a-text-file-report&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#mtr-to-create-a-text-file-report&quot; aria-label=&quot;Anchor link for: mtr-to-create-a-text-file-report&quot;&gt;🔗&lt;/a&gt;mtr to create a text file report&lt;/h1&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ sudo mtr --report --report-cycles 10 immortal.run &amp;gt; /tmp/immortal-mtr.txt&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Example of output:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;Start:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; Tue Apr&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 25&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; 17:58:11&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 2017&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;HOST:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; M20160001.local             Loss%   Snt   Last   Avg  Best  Wrst StDev&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;  1.&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;--&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 10.19.15.254&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;               0.0%&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;    10   41.7  41.2  25.1  81.6  16.8&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;  2.&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;--&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 10.19.0.1&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;                  0.0%&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;    10    0.5   0.5   0.4   0.6   0.0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;  3.&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;--&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 23.189.27.97&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;               0.0%&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;    10    1.2   8.5   1.0  74.4  23.2&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;  4.&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;--&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 89.27.149.117&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;             80.0%&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;    10    1.3  18.4   1.3  35.4  24.1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;  5.&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;--&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 62.214.33.237&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;              0.0%&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;    10    7.0   2.3   1.1   7.0   2.2&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;  6.&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;--&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 62.214.37.118&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;              0.0%&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;    10    5.1   3.5   1.5  12.8   3.6&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;  7.&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;--&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; cloudflare.bcix.de         0.0%&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;    10    1.8   2.5   1.6   8.4   2.0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;  8.&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;--&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 104.18.53.220&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;              0.0%&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;    10    1.9   2.1   1.6   3.6   0.3&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;mtr on specific port:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mtr -w -c 100 -b -T -P 587 smtp.server.tld &amp;gt; smtp-mtr.txt&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The &lt;code&gt;-w -c 100 -b -T&lt;/code&gt; runs a verbose report 100x, logging both IPs &amp;amp; Hostnames,
for a good dataset. This also runs the queries through TCP, to avoid ICMP
de-prioritization.&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>mysql backup</title>
        <published>2017-04-11T10:28:49+02:00</published>
        <updated>2017-04-11T10:28:49+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/mysql-backup/"/>
        <id>https://nbari.com/mysql-backup/</id>
        
        <content type="html" xml:base="https://nbari.com/mysql-backup/">&lt;h1 id=&quot;mysqldump-xz-openssl&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#mysqldump-xz-openssl&quot; aria-label=&quot;Anchor link for: mysqldump-xz-openssl&quot;&gt;🔗&lt;/a&gt;mysqldump + xz + openssl&lt;/h1&gt;
&lt;p&gt;First add to &lt;code&gt;.my.cnf&lt;/code&gt; the proper username/password to avoid getting a warning:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;[&lt;/span&gt;&lt;span&gt;client&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;host&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; = localhost&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; = dbadmin&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;password&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; = secret&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To take the dump and keep it only for 31 days:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;#!/bin/sh&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;DAY&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=$(&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;date&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; +%d&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;mysqldump&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; --events --routines --triggers --add-drop-database --compress --hex-blob --opt --skip-comments --single-transaction dbname&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; |&lt;/span&gt;&lt;span&gt; \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;xz&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -c&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; |&lt;/span&gt;&lt;span&gt; \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;openssl&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; smime -encrypt -aes256 -binary -out /safe/path/&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;${&lt;/span&gt;&lt;span&gt;DAY&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;.sql.xz.enc -outform DER /path/to/cert.pem&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;mysqldump&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#mysqldump&quot; aria-label=&quot;Anchor link for: mysqldump&quot;&gt;🔗&lt;/a&gt;mysqldump&lt;/h2&gt;
&lt;p&gt;The options used:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;mysqldump&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; --events --routines --triggers --add-drop-database --compress --hex-blob --opt --skip-comments --single-transaction --databases dbname&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;The --databases option will add the CREATE DATABASE&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Example multiple databases:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;mysqldump&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; --events --routines --triggers&lt;/span&gt;&lt;span&gt; \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;--add-drop-database&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; --compress --hex-blob&lt;/span&gt;&lt;span&gt; \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;--opt&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; --skip-comments --single-transaction&lt;/span&gt;&lt;span&gt; \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;--databases&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; dbname dbname2 dbname3&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;xz&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#xz&quot; aria-label=&quot;Anchor link for: xz&quot;&gt;🔗&lt;/a&gt;xz&lt;/h2&gt;
&lt;p&gt;Compress the output:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;xz -c&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;-c is to write to stdout&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id=&quot;openssl-encrypt&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#openssl-encrypt&quot; aria-label=&quot;Anchor link for: openssl-encrypt&quot;&gt;🔗&lt;/a&gt;openssl (encrypt)&lt;/h2&gt;
&lt;p&gt;Encrypt the backup using asymmetric encryption (key pairs):&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;openssl&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; smime -encrypt -aes256 -stream -binary -out /safe/path/&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;${&lt;/span&gt;&lt;span&gt;DAY&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;.sql.xz.enc -outform DER /path/to/cert.pem&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;Notice the -stream option, it helps to encrypt files bigger than 1.5 GB, and ouput is piped: xz -c |&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;How to create a pair of keys using openssl:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; openssl req -x509 -newkey rsa:4096 -sha256 -nodes -keyout example.key -out example.pem -subj&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;/CN=example.com&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -days&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 3650&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;To add password to the key remove the &lt;code&gt;-nodes&lt;/code&gt; (No DES encryption) options. https://security.stackexchange.com/a/106530/54143&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id=&quot;decrypt&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#decrypt&quot; aria-label=&quot;Anchor link for: decrypt&quot;&gt;🔗&lt;/a&gt;Decrypt&lt;/h2&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;openssl&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; smime -decrypt -in database.sql.xz.enc -binary -inform DEM -inkey example.key -out database.sql.xz&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;un-compress&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#un-compress&quot; aria-label=&quot;Anchor link for: un-compress&quot;&gt;🔗&lt;/a&gt;Un-compress&lt;/h2&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;xz&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -d database.sql.xz&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>mysql root password</title>
        <published>2017-04-10T15:37:08+02:00</published>
        <updated>2017-04-10T15:37:08+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/mysql-root-password/"/>
        <id>https://nbari.com/mysql-root-password/</id>
        
        <content type="html" xml:base="https://nbari.com/mysql-root-password/">&lt;h1 id=&quot;reset-root-password-on-mysql-5-7-17&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#reset-root-password-on-mysql-5-7-17&quot; aria-label=&quot;Anchor link for: reset-root-password-on-mysql-5-7-17&quot;&gt;🔗&lt;/a&gt;Reset root password on mysql &amp;gt;= 5.7.17&lt;/h1&gt;
&lt;p&gt;Edit &lt;code&gt;/etc/rc.conf&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mysql_args=&amp;quot;--skip-grant-tables --skip-networking&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Restart mysql:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;service mysql-server restart&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Login like root:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mysql&amp;gt; UPDATE mysql.user SET authentication_string = PASSWORD(&amp;#39;aaaa&amp;#39;) WHERE User = &amp;#39;root&amp;#39; AND Host = &amp;#39;localhost&amp;#39;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mysql&amp;gt; FLUSH PRIVILEGES;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mysql&amp;gt; quit&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Remove or comment:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# mysql_args=&amp;quot;--skip-grant-tables --skip-networking&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Restart mysql:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;service mysql-server restart&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h1 id=&quot;mysqldump-couldn-t-execute-show-variables-like-gtid-mode&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#mysqldump-couldn-t-execute-show-variables-like-gtid-mode&quot; aria-label=&quot;Anchor link for: mysqldump-couldn-t-execute-show-variables-like-gtid-mode&quot;&gt;🔗&lt;/a&gt;mysqldump: Couldn&#39;t execute &#39;SHOW VARIABLES LIKE &#39;gtid_mode&#39;&#39;:&lt;/h1&gt;
&lt;p&gt;To fix that try this:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# mysql_upgrade -u root -p --force&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>dsymutil golang</title>
        <published>2017-04-04T14:02:14+02:00</published>
        <updated>2017-04-04T14:02:14+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/dsymutil-golang/"/>
        <id>https://nbari.com/dsymutil-golang/</id>
        
        <content type="html" xml:base="https://nbari.com/dsymutil-golang/">&lt;p&gt;Go executables broken in macOS 10.12.X&lt;/p&gt;
&lt;p&gt;When compiling and executing this may happen:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ zsh: killed ./main&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Temporary fix:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ ln -s /usr/bin/true /usr/local/bin/dsymutil&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>pkgin</title>
        <published>2017-03-30T01:00:29+02:00</published>
        <updated>2017-03-30T01:00:29+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/pkgin/"/>
        <id>https://nbari.com/pkgin/</id>
        
        <content type="html" xml:base="https://nbari.com/pkgin/">&lt;p&gt;To install pkgin in NetBSD:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# export PKG_PATH=&amp;quot;http://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/amd64/7.0.1/All/&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;then:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# pkg_add -v pkgin-*&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Finish by updating:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# pkgin update&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Diffie Hellman</title>
        <published>2017-03-25T19:51:28+01:00</published>
        <updated>2017-03-25T19:51:28+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/diffie-hellman/"/>
        <id>https://nbari.com/diffie-hellman/</id>
        
        <content type="html" xml:base="https://nbari.com/diffie-hellman/">&lt;div class=&quot;video-embed&quot;&gt;
    &lt;iframe src=&quot;https://www.youtube-nocookie.com/embed/YEBfamv-_do&quot; title=&quot;YouTube video&quot; loading=&quot;lazy&quot; allow=&quot;accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen&gt;&lt;/iframe&gt;
&lt;/div&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>sqlite2file</title>
        <published>2017-03-23T14:43:09+01:00</published>
        <updated>2017-03-23T14:43:09+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/sqlite2file/"/>
        <id>https://nbari.com/sqlite2file/</id>
        
        <content type="html" xml:base="https://nbari.com/sqlite2file/">&lt;p&gt;Sqlite query to a file:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sqlite&amp;gt; .mode ascii&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sqlite&amp;gt; .output data.txt&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sqlite&amp;gt; .select * from table;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Or dump to a file:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sqlite3 db.sqlite .dump  &amp;gt; dump&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>text2json</title>
        <published>2017-03-23T12:22:05+01:00</published>
        <updated>2017-03-23T12:22:05+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/text2json/"/>
        <id>https://nbari.com/text2json/</id>
        
        <content type="html" xml:base="https://nbari.com/text2json/">&lt;p&gt;Convert txt to json:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; $ jq &amp;#39;.&amp;#39; -R -s file&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;or&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ echo textfile | jq &amp;#39;.&amp;#39; -R -s&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>routing flags</title>
        <published>2017-03-21T15:27:09+01:00</published>
        <updated>2017-03-21T15:27:09+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/routing-flags/"/>
        <id>https://nbari.com/routing-flags/</id>
        
        <content type="html" xml:base="https://nbari.com/routing-flags/">&lt;p&gt;From netstat(1) man page:&lt;/p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Letter&lt;/th&gt;&lt;th&gt;Flag&lt;/th&gt;&lt;th&gt;Meaning&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;1&lt;/td&gt;&lt;td&gt;RTF_PROTO1&lt;/td&gt;&lt;td&gt;Protocol specific routing flag #1&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;2&lt;/td&gt;&lt;td&gt;RTF_PROTO2&lt;/td&gt;&lt;td&gt;Protocol specific routing flag #2&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;3&lt;/td&gt;&lt;td&gt;RTF_PROTO3&lt;/td&gt;&lt;td&gt;Protocol specific routing flag #3&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;B&lt;/td&gt;&lt;td&gt;RTF_BLACKHOLE&lt;/td&gt;&lt;td&gt;Just discard packets (during updates)&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;b&lt;/td&gt;&lt;td&gt;RTF_BROADCAST&lt;/td&gt;&lt;td&gt;The route represents a broadcast address&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;C&lt;/td&gt;&lt;td&gt;RTF_CLONING&lt;/td&gt;&lt;td&gt;Generate new routes on use&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;c&lt;/td&gt;&lt;td&gt;RTF_PRCLONING&lt;/td&gt;&lt;td&gt;Protocol-specified generate new routes on use&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;D&lt;/td&gt;&lt;td&gt;RTF_DYNAMIC&lt;/td&gt;&lt;td&gt;Created dynamically (by redirect)&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;G&lt;/td&gt;&lt;td&gt;RTF_GATEWAY&lt;/td&gt;&lt;td&gt;Destination requires forwarding by intermediary&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;H&lt;/td&gt;&lt;td&gt;RTF_HOST&lt;/td&gt;&lt;td&gt;Host entry (net otherwise)&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;I&lt;/td&gt;&lt;td&gt;RTF_IFSCOPE&lt;/td&gt;&lt;td&gt;Route is associated with an interface scope&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;i&lt;/td&gt;&lt;td&gt;RTF_IFREF&lt;/td&gt;&lt;td&gt;Route is holding a reference to the interface&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;L&lt;/td&gt;&lt;td&gt;RTF_LLINFO&lt;/td&gt;&lt;td&gt;Valid protocol to link address translation&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;M&lt;/td&gt;&lt;td&gt;RTF_MODIFIED&lt;/td&gt;&lt;td&gt;Modified dynamically (by redirect)&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;m&lt;/td&gt;&lt;td&gt;RTF_MULTICAST&lt;/td&gt;&lt;td&gt;The route represents a multicast address&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;R&lt;/td&gt;&lt;td&gt;RTF_REJECT&lt;/td&gt;&lt;td&gt;Host or net unreachable&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;r&lt;/td&gt;&lt;td&gt;RTF_ROUTER&lt;/td&gt;&lt;td&gt;Host is a default router&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;S&lt;/td&gt;&lt;td&gt;RTF_STATIC&lt;/td&gt;&lt;td&gt;Manually added&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;U&lt;/td&gt;&lt;td&gt;RTF_UP&lt;/td&gt;&lt;td&gt;Route usable&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;W&lt;/td&gt;&lt;td&gt;RTF_WASCLONED&lt;/td&gt;&lt;td&gt;Route was generated as a result of cloning&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;X&lt;/td&gt;&lt;td&gt;RTF_XRESOLVE&lt;/td&gt;&lt;td&gt;External daemon translates proto to link address&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Y&lt;/td&gt;&lt;td&gt;RTF_PROXY&lt;/td&gt;&lt;td&gt;Proxying; cloned routes will not be scoped&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;p&gt;To find current gateway when using a VPN:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; netstat -rna -f inet | grep UGHS | awk &amp;#39;{print $1}&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>nil pointer</title>
        <published>2017-03-17T17:03:36+01:00</published>
        <updated>2017-03-17T17:03:36+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/nil-pointer/"/>
        <id>https://nbari.com/nil-pointer/</id>
        
        <content type="html" xml:base="https://nbari.com/nil-pointer/">&lt;p&gt;To check that &lt;code&gt;x&lt;/code&gt; implements &lt;code&gt;y&lt;/code&gt;, example:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;go&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;package&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt; main&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; (&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;fmt&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;io&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;os&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;var&lt;/span&gt;&lt;span&gt; _&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt; io&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;ReadCloser&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; = (*&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;os&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;File&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;)(nil)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;func&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt; main&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;() {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    fmt&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt;Println&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;(&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;Hello, playground&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;https://play.golang.org/p/hoi5_GQEpD&lt;/p&gt;
&lt;p&gt;To check that &lt;code&gt;os.File&lt;/code&gt; is an &lt;code&gt;io.ReadCloser&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;var _ io.ReadCloser = (*os.File)(nil)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;go&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;package&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt; main&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; (&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;	&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;fmt&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;	&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;io&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;	&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;os&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;var&lt;/span&gt;&lt;span&gt; _&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt; io&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;ReadCloser&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; = (*&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;os&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;Process&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;)(nil)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;func&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt; main&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;() {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	fmt&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt;Println&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;(&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;Hello, playground&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;https://play.golang.org/p/7uHmjn3ggT&lt;/p&gt;
&lt;p&gt;The error in this case would be:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;main.go:9: cannot use (*os.Process)(nil) (type *os.Process) as type io.ReadCloser in assignment:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;*os.Process does not implement io.ReadCloser (missing Close method)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>ssh ed25519</title>
        <published>2017-03-08T21:00:46+01:00</published>
        <updated>2017-03-08T21:00:46+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/ssh-ed25519/"/>
        <id>https://nbari.com/ssh-ed25519/</id>
        
        <content type="html" xml:base="https://nbari.com/ssh-ed25519/">&lt;p&gt;Generate your new ssh &lt;a rel=&quot;external&quot; href=&quot;https://en.wikipedia.org/wiki/EdDSA&quot;&gt;ed25519&lt;/a&gt; key:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ ssh-keygen -o -a 1000 -t ed25519&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>urandom</title>
        <published>2017-03-08T15:04:59+01:00</published>
        <updated>2017-03-08T15:04:59+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/urandom/"/>
        <id>https://nbari.com/urandom/</id>
        
        <content type="html" xml:base="https://nbari.com/urandom/">&lt;h1 id=&quot;dev-urandom&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#dev-urandom&quot; aria-label=&quot;Anchor link for: dev-urandom&quot;&gt;🔗&lt;/a&gt;/dev/urandom&lt;/h1&gt;
&lt;p&gt;To generate a random string/password of 32 chars using &lt;code&gt;/dev/urandom&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ base64 /dev/urandom | head -c 32&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>bitwise chmod</title>
        <published>2017-03-02T16:37:44+01:00</published>
        <updated>2017-03-02T16:37:44+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/bitwise-chmod/"/>
        <id>https://nbari.com/bitwise-chmod/</id>
        
        <content type="html" xml:base="https://nbari.com/bitwise-chmod/">&lt;h1 id=&quot;111-111-111&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#111-111-111&quot; aria-label=&quot;Anchor link for: 111-111-111&quot;&gt;🔗&lt;/a&gt;111 111 111&lt;/h1&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;/th&gt;&lt;th&gt;&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;octal&lt;/td&gt;&lt;td&gt;777&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;decimal&lt;/td&gt;&lt;td&gt;511&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;binary&lt;/td&gt;&lt;td&gt;111 111 111&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;perm&lt;/td&gt;&lt;td&gt;rwx rwx rwx&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;4 = r&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;2 = w&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;1 = x&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;rwx = 4+2+1 = 7&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;rw  = 4+2+0 = 6&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;r   = 4+0+0 = 4&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;r x = 4+0+1 = 5&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;7 = binary 111 = rwx&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;6 = binary 110 = rw-&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;5 = binary 101 = r-x&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;4 = binary 100 = r--&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;3 = binary 011 = -wx&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;2 = binary 010 = -w-&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;1 = binary 001 = --x&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0 = binary 000 = ---&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The full set of nine permission characters can then be grouped and summarized as three octal digits:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;rwxr-x-wx  is  rwx|r-x|-wx  is 111|101|011 ==&amp;gt; the three digits 753&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---r----x  is  ---|r--|--x  is 000|100|001 ==&amp;gt; the three digits 041&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---------  is  ---|---|---  is 000|000|000 ==&amp;gt; the three digits 000&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;rwxrwxrwx  is  rwx|rwx|rwx  is 111|111|111 ==&amp;gt; the three digits 777&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Convert octal to decimal using python:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;gt;&amp;gt;&amp;gt; int(&amp;#39;777&amp;#39;, 8)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Decimal to binary:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;gt;&amp;gt;&amp;gt; &amp;quot;{0:b}&amp;quot;.format(511)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;#39;111111111&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Bitwise AND with 07777 gives the last twelve bits of a number’s binary
representation. With a Unix mode, this operation gives the permission or mode
bits and discards any type information.&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ perl -e &amp;#39;printf &amp;quot;%d\n&amp;quot;, (stat &amp;quot;foo&amp;quot;)[2] &amp;amp; 07777&amp;#39;  # decimal, not useful&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;420&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ perl -e &amp;#39;printf &amp;quot;%o\n&amp;quot;, (stat &amp;quot;foo&amp;quot;)[2] &amp;amp; 07777&amp;#39;  # octal&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;644&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>add subtitles</title>
        <published>2017-02-20T20:49:14+01:00</published>
        <updated>2017-02-20T20:49:14+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/add-subtitles/"/>
        <id>https://nbari.com/add-subtitles/</id>
        
        <content type="html" xml:base="https://nbari.com/add-subtitles/">&lt;h1 id=&quot;add-subtitles-to-a-mkv-file&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#add-subtitles-to-a-mkv-file&quot; aria-label=&quot;Anchor link for: add-subtitles-to-a-mkv-file&quot;&gt;🔗&lt;/a&gt;Add subtitles to a mkv file:&lt;/h1&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ffmpeg -i input.mkv -f srt -i input.srt  -map 0:0 -map 0:1 -map 1:0 -c:v copy -c:a copy -c:s srt  output.mkv&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>rds slave from external master</title>
        <published>2017-02-10T13:47:24+01:00</published>
        <updated>2017-02-10T13:47:24+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/rds-slave-from-external-master/"/>
        <id>https://nbari.com/rds-slave-from-external-master/</id>
        
        <content type="html" xml:base="https://nbari.com/rds-slave-from-external-master/">&lt;h2 id=&quot;setup-aws-mysql-rds-instance-as-slave-of-an-external-master&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#setup-aws-mysql-rds-instance-as-slave-of-an-external-master&quot; aria-label=&quot;Anchor link for: setup-aws-mysql-rds-instance-as-slave-of-an-external-master&quot;&gt;🔗&lt;/a&gt;Setup AWS MySQL RDS instance as slave of an external master&lt;/h2&gt;
&lt;p&gt;Configure external mysql to become master:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;server-id=1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;binlog-format= mixed&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;log-bin=mysql-bin&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;binlog-do-db=databasename&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Setup the master replica user:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mysql&amp;gt; create user `replica`@`%` identified by &amp;#39;PASSWORD&amp;#39;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mysql&amp;gt; grant replication slave on *.* to &amp;#39;replica&amp;#39;@&amp;#39;%&amp;#39;;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Use the following command to ensure that nothing can write to the master
database during a database dump. Also note the filename and position of the
binary log because you will need these values to complete the replication
configuration:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mysql&amp;gt; FLUSH TABLES WITH READ LOCK;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mysql&amp;gt; show master status;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+-------------------+-----------+--------------+--------------------------------------------------+&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;| File              | Position  | Binlog_Do_DB | Binlog_Ignore_DB                                 |&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+-------------------+-----------+--------------+--------------------------------------------------+&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;| mysqld-bin.000205 | 207450664 | epazote      | test,information_schema,performance_schema,mysql |&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+-------------------+-----------+--------------+--------------------------------------------------+&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;1 row in set (0.00 sec)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If this is a replica do this:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mysql&amp;gt; show slave status\G&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And look for:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Master_Log_File: mysql-bin-changelog.023713&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Read_Master_Log_Pos: 1934704&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Within AWS RDS you can also do:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mysql&amp;gt; call mysql.rds_stop_replication;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mysql&amp;gt; show slave status\G&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Take a dump:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mysqldump -h host.tld --user=&amp;#39;user&amp;#39; --password=&amp;#39;secret&amp;#39; --add-drop-database --compress --hex-blob --opt --skip-comments --skip-lock-tables --single-transaction db_name &amp;gt; out.sql&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;to dump all databases use &lt;code&gt;--all-databases&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;To get the the log position this can be used:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;--master-data=1&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;example:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mysqldump -h host.tld --master-data=1 --compress --hex-blob --opt --skip-comments --skip-lock-tables --single-transaction db_name -u user -p &amp;gt; out.sql&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then, lift the read lock from the master:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mysql&amp;gt; UNLOCK TABLES;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;or within AWS use:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mysql&amp;gt; call mysql.rds_start_replication;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;If you get a Last_IO_Error: Got fatal error 1236..., if you can afford it, don&#39;t unlock/start the replication after having the dump&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Load the dump:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mysql --compress -h host.tld -u user database &amp;lt; out.sql&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;--compress seems to improve the speed&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;After loading a full dump to RDS, Call the stored procedure &lt;a rel=&quot;external&quot; href=&quot;http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/mysql_rds_set_external_master.html&quot;&gt;mysql.rds_set_external_master&lt;/a&gt; like this:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mysql&amp;gt; call mysql.rds_set_external_master (&amp;#39;servername&amp;#39;, port, &amp;#39;user&amp;#39;, &amp;#39;password&amp;#39;, &amp;#39;binlog-file&amp;#39;, binlog-offset, 0);&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Example:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mysql&amp;gt; call mysql.rds_set_external_master (&amp;#39;10.10.3.2&amp;#39;, 3306, &amp;#39;replica&amp;#39;, &amp;#39;password&amp;#39;, &amp;#39;mysql-bin-changelog.122&amp;#39;, 108433, 0);&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then start the replication by doing:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mysql&amp;gt; call mysql.rds_start_replication;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Check if slave is running:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mysql&amp;gt; show slave status;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;promote-rds-to-master&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#promote-rds-to-master&quot; aria-label=&quot;Anchor link for: promote-rds-to-master&quot;&gt;🔗&lt;/a&gt;Promote RDS to master&lt;/h2&gt;
&lt;p&gt;This will promote the slave to become master:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mysql&amp;gt; call mysql.rds_stop_replication;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mysql&amp;gt; call mysql.rds_reset_external_master;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;mysql-rds-set-configuration&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#mysql-rds-set-configuration&quot; aria-label=&quot;Anchor link for: mysql-rds-set-configuration&quot;&gt;🔗&lt;/a&gt;mysql.rds_set_configuration&lt;/h2&gt;
&lt;p&gt;In Amazon RDS, The default value of binlog retention hours is NULL (do not
retain binary logs), to keep logs for 7 days use:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;call mysql.rds_set_configuration(&amp;#39;binlog retention hours&amp;#39;, 168);&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This could help to prevent getting the error:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Got fatal error 1236 from master when reading data from binary log: &amp;#39;Could not find first log file name in binary log index file&amp;#39;, Error_code: 1236&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>haproxy</title>
        <published>2017-02-09T13:53:50+01:00</published>
        <updated>2017-02-09T13:53:50+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/haproxy/"/>
        <id>https://nbari.com/haproxy/</id>
        
        <content type="html" xml:base="https://nbari.com/haproxy/">&lt;h1 id=&quot;haproxy-http-auth-ip-src&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#haproxy-http-auth-ip-src&quot; aria-label=&quot;Anchor link for: haproxy-http-auth-ip-src&quot;&gt;🔗&lt;/a&gt;HAproxy + HTTP auth + IP SRC&lt;/h1&gt;
&lt;p&gt;Use HTTP Auth when source IP is not from an allowed source:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;userlist TestUsers&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    user guest insecure-password secret&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;backend test-node&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    acl network_allowed src 10.0.0.1 192.30.252.0/22&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    acl AuthOK http_auth(TempUsers)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    http-request auth realm Test if !network_allowed !AuthOK&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    server test test.server.tld:80 maxconn 50 check&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To only allow specific range, for example only GitHub:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; acl network_allowed src 192.30.252.0/22 185.199.108.0/22&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; http-request deny if !network_allowed&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h1 id=&quot;haproxy-mysql&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#haproxy-mysql&quot; aria-label=&quot;Anchor link for: haproxy-mysql&quot;&gt;🔗&lt;/a&gt;HAproxy + mysql&lt;/h1&gt;
&lt;p&gt;First setup mysql by creating a HAproxy to do the checks:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;USE mysql;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;INSERT INTO user (Host,User) values(&amp;#39;%&amp;#39;, &amp;#39;haproxy&amp;#39;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;FLUSH PRIVILEGES;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In case you are here because you ran out of connections you can do:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mysql&amp;gt; FLUSH HOSTS;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then you can use something like:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;backend rds-mysql&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    mode tcp&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    balance leastconn&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    option tcpka&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    option mysql-check user haproxy&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    server rds mysql.eu-central-1.rds.amazonaws.com:3306 check&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;https://www.haproxy.com/doc/aloha/7.0/haproxy/healthchecks.html#checking-a-mysql-service&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>ssh proxy</title>
        <published>2017-02-07T11:54:20+01:00</published>
        <updated>2017-02-07T11:54:20+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/ssh-proxy/"/>
        <id>https://nbari.com/ssh-proxy/</id>
        
        <content type="html" xml:base="https://nbari.com/ssh-proxy/">&lt;h1 id=&quot;ssh-socks5-proxy&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#ssh-socks5-proxy&quot; aria-label=&quot;Anchor link for: ssh-socks5-proxy&quot;&gt;🔗&lt;/a&gt;SSH SOCKS5 proxy&lt;/h1&gt;
&lt;p&gt;Route web traffic securely without a VPN using a SOCKS tunnel with ssh:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ ssh -D 8080 -f -C -q -N user@remote.host&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;-D 8080 tells ssh to launch a SOCKS server on port 8080 locally.&lt;/li&gt;
&lt;li&gt;-f Forks the process to the background.&lt;/li&gt;
&lt;li&gt;-C Compresses the data before sending it.&lt;/li&gt;
&lt;li&gt;-q  Uses quiet mode.&lt;/li&gt;
&lt;li&gt;-N Tells SSH that no command will be sent once the tunnel is up.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;configure-firefox&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#configure-firefox&quot; aria-label=&quot;Anchor link for: configure-firefox&quot;&gt;🔗&lt;/a&gt;Configure firefox&lt;/h2&gt;
&lt;p&gt;&lt;img src=&quot;/img/ssh-proxy.png&quot; alt=&quot;ssh-proxy&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;&lt;/p&gt;
&lt;h2 id=&quot;curl&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#curl&quot; aria-label=&quot;Anchor link for: curl&quot;&gt;🔗&lt;/a&gt;curl&lt;/h2&gt;
&lt;p&gt;To use socks5 in curl try:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;curl -x socks5h://localhost:8080 http://myip.country&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h1 id=&quot;ssh-tunnel-tcp-forwarding&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#ssh-tunnel-tcp-forwarding&quot; aria-label=&quot;Anchor link for: ssh-tunnel-tcp-forwarding&quot;&gt;🔗&lt;/a&gt;SSH tunnel / TCP forwarding&lt;/h1&gt;
&lt;p&gt;If you only need to access an open port on the remote server:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ ssh -L 8080:localhost:1234 -Nf user@your-remote-server.com&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The option &lt;code&gt;-L&lt;/code&gt; will do a local port forwarding from port &lt;code&gt;8080&lt;/code&gt; (your computer)
to port &lt;code&gt;1234&lt;/code&gt; in &lt;code&gt;localhost&lt;/code&gt; (the remote server), then in your browser just enter:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    http://localhost:8080&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If this is a web server you will see hopefully the content, but you could also
use this technique for a database, for example&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ ssh -L 3307:localhost:3306 user@your-remote-server.com&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This will forward port 3307 (your computer) to &lt;code&gt;3306&lt;/code&gt; remotely (mysql server)&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ mysql -h localhost -P 3307&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You can read/remember this as &lt;code&gt;-L&lt;/code&gt; forward my local port &lt;code&gt;XXXX&lt;/code&gt; to &lt;code&gt;remote address (localhost/google.com/any-server.tld&lt;/code&gt; at port &lt;code&gt;YYYY&lt;/code&gt; through
&lt;code&gt;user@remote-server.com&lt;/code&gt;&lt;/p&gt;
&lt;h1 id=&quot;manage-your-pfsense&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#manage-your-pfsense&quot; aria-label=&quot;Anchor link for: manage-your-pfsense&quot;&gt;🔗&lt;/a&gt;Manage your pfsense&lt;/h1&gt;
&lt;p&gt;If you could could ssh to a server within your infrastructure you could do then:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ssh -L 8443:192.168.1.1:443 -Nf &amp;lt;user&amp;gt;@host&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then in your browser:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;https://localhost:8443&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h1 id=&quot;provide-internet-to-a-server-behind-a-firewall&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#provide-internet-to-a-server-behind-a-firewall&quot; aria-label=&quot;Anchor link for: provide-internet-to-a-server-behind-a-firewall&quot;&gt;🔗&lt;/a&gt;Provide internet to a server behind a firewall&lt;/h1&gt;
&lt;p&gt;Enable ssh on your desktop/laptop (from where you are connecting) and then run
(it will ask your local ssh password and then the remotes ssh password):&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ssh -t -D 1080 localhost ssh -R 1080:localhost:1080 user@10.0.0.8&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;check that in the remote host has &lt;code&gt;AllowTcpForwarding yes&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Then you could use socks5 from the remote server:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;curl --socks5-hostname 127.0.0.1:1080 http://myip.country&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;or&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;curl -x socks5h://127.0.0.1:1080 http://myip.country&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then to use it:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;export http_proxy=socks5h://127.0.0.1:1080&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;export https_proxy=socks5h://127.0.0.1:1080&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If need to install  &lt;code&gt;pipenv&lt;/code&gt; you may need &lt;code&gt;privoxy&lt;/code&gt;&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;yum install privoxy&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Edit the configuration file &lt;code&gt;/etc/privoxy/config&lt;/code&gt; and add this line:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;forward-socks5 / 127.0.0.1:1080 .&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Start the service and then you could use:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;export http_proxy=http://127.0.0.1:8118&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;export https_proxy=http://127.0.0.1:8118&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>HSTS</title>
        <published>2017-02-06T15:01:22+01:00</published>
        <updated>2017-02-06T15:01:22+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/hsts/"/>
        <id>https://nbari.com/hsts/</id>
        
        <content type="html" xml:base="https://nbari.com/hsts/">&lt;h1 id=&quot;http-will-change-to-https&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#http-will-change-to-https&quot; aria-label=&quot;Anchor link for: http-will-change-to-https&quot;&gt;🔗&lt;/a&gt;http://... will change to https://...&lt;/h1&gt;
&lt;p&gt;If you own a site that you would like to see included in the preloaded HSTS list
you can submit it at https://hstspreload.appspot.com.&lt;/p&gt;
&lt;h2 id=&quot;verify-http-strict-transport-security-hsts-header-with-curl&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#verify-http-strict-transport-security-hsts-header-with-curl&quot; aria-label=&quot;Anchor link for: verify-http-strict-transport-security-hsts-header-with-curl&quot;&gt;🔗&lt;/a&gt;verify HTTP Strict Transport Security (HSTS) header with curl&lt;/h2&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ curl -Is https://google.com | grep -i stric&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Strict-Transport-Security: max-age=15552000; includeSubDomains&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;remove-domain-from-chrome&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#remove-domain-from-chrome&quot; aria-label=&quot;Anchor link for: remove-domain-from-chrome&quot;&gt;🔗&lt;/a&gt;Remove domain from chrome&lt;/h2&gt;
&lt;p&gt;Search for the domain in: &lt;a href=&quot;chrome://net-internals/#hsts&quot;&gt;chrome://net-internals/#hsts&lt;/a&gt;
and delete it.&lt;/p&gt;
&lt;h2 id=&quot;http-strict-transport-security&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#http-strict-transport-security&quot; aria-label=&quot;Anchor link for: http-strict-transport-security&quot;&gt;🔗&lt;/a&gt;HTTP Strict Transport Security&lt;/h2&gt;
&lt;p&gt;The issue that HSTS addresses is that users tend to type http:// at best, and
omit the scheme entirely most of the time. In the latter case, browsers will
insert http:// for them.&lt;/p&gt;
&lt;p&gt;However, HTTP is insecure. An attacker can grab that connection, manipulate
it and only the most eagle eyed users might notice that it redirected to
https://www.bank0famerica.com or some such. From then on, the user is under the
control of the attacker, who can intercept passwords etc at will.&lt;/p&gt;
&lt;p&gt;An HSTS enabled server can include the following header in an HTTPS reply:&lt;/p&gt;
&lt;p&gt;Strict-Transport-Security: max-age=16070400; includeSubDomains&lt;/p&gt;
&lt;p&gt;When the browser sees this, it will remember, for the given number of seconds,
that the current domain should only be contacted over HTTPS. In the future, if
the user types http:// or omits the scheme, HTTPS is the default. In fact, all
requests for URLs in the current domain will be redirected to HTTPS. (So you
have to make sure that you can serve them all!).&lt;/p&gt;
&lt;p&gt;More info: https://www.chromium.org/hsts&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>ssh escape sequences</title>
        <published>2017-02-05T17:57:39+01:00</published>
        <updated>2017-02-05T17:57:39+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/ssh-escape-sequences/"/>
        <id>https://nbari.com/ssh-escape-sequences/</id>
        
        <content type="html" xml:base="https://nbari.com/ssh-escape-sequences/">&lt;p&gt;While using ssh your connection may become idle or unresponsive in any case
instead of waiting you can simple terminate the connection by sending a escape
sequence:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;~.&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h1 id=&quot;ssh-escape-sequences&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#ssh-escape-sequences&quot; aria-label=&quot;Anchor link for: ssh-escape-sequences&quot;&gt;🔗&lt;/a&gt;SSH escape sequences&lt;/h1&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;sequence&lt;/th&gt;&lt;th&gt;description&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;~.&lt;/td&gt;&lt;td&gt;terminate connection (and any multiplexed sessions)&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;~B&lt;/td&gt;&lt;td&gt;send a BREAK to the remote system&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;~C&lt;/td&gt;&lt;td&gt;open a command line&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;~R&lt;/td&gt;&lt;td&gt;request rekey&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;~V/v&lt;/td&gt;&lt;td&gt;decrease/increase verbosity (LogLevel)&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;~^Z&lt;/td&gt;&lt;td&gt;suspend ssh&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;~#&lt;/td&gt;&lt;td&gt;list forwarded connections&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;~&amp;amp;&lt;/td&gt;&lt;td&gt;background ssh (when waiting for connections to terminate)&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;~?&lt;/td&gt;&lt;td&gt;this message&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;~~&lt;/td&gt;&lt;td&gt;send the escape character by typing it twice&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>perfomance checklist</title>
        <published>2017-01-24T15:12:56+01:00</published>
        <updated>2017-01-24T15:12:56+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/perfomance-checklist/"/>
        <id>https://nbari.com/perfomance-checklist/</id>
        
        <content type="html" xml:base="https://nbari.com/perfomance-checklist/">&lt;h1 id=&quot;perfomance-checklist-for-sre-s&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#perfomance-checklist-for-sre-s&quot; aria-label=&quot;Anchor link for: perfomance-checklist-for-sre-s&quot;&gt;🔗&lt;/a&gt;Perfomance checklist for SRE&#39;s&lt;/h1&gt;
&lt;h2 id=&quot;linux-perf-analysis-in-60s&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#linux-perf-analysis-in-60s&quot; aria-label=&quot;Anchor link for: linux-perf-analysis-in-60s&quot;&gt;🔗&lt;/a&gt;Linux Perf Analysis in 60s&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;uptime  &lt;code&gt;load averages&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;dmesg -T | tail &lt;code&gt;kernel errors&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;vmstat 1 &lt;code&gt;overall stats by time&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;mpstat -P ALL 1 &lt;code&gt;CPU balance&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;pidstat 1 &lt;code&gt;process usage&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;iostat -xz 1 &lt;code&gt;disk I/O&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;free -m &lt;code&gt;memory usage&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;sar -n DEV 1 &lt;code&gt;network I/O&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;sar -n TCP,ETCP 1 &lt;code&gt;TCP stats&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;top &lt;code&gt;check overview&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;linux-disk-checklist&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#linux-disk-checklist&quot; aria-label=&quot;Anchor link for: linux-disk-checklist&quot;&gt;🔗&lt;/a&gt;Linux Disk Checklist&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;iostat -xz 1 &lt;code&gt;any disk I/O? if not, stop looking&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;vmstat 1 &lt;code&gt;is this swapping? or, high sys time?&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;df -h &lt;code&gt;are file systems nearly full?&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;ext4slower 10 &lt;code&gt;(zfs*, xfs*, etc.) slow file system I/O?&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;bioslower 10 &lt;code&gt;if so, check disks&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;ext4dist 1 &lt;code&gt;check distribution and rate&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;biolatency 1 &lt;code&gt;if interesting, check disks&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;cat /sys/devices/…/ioerr_cnt &lt;code&gt;(if available) errors&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;smartctl -l error /dev/sda1 &lt;code&gt;(if available) errors&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;linux-network-checklist&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#linux-network-checklist&quot; aria-label=&quot;Anchor link for: linux-network-checklist&quot;&gt;🔗&lt;/a&gt;Linux Network Checklist&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;sar -n DEV,EDEV 1 &lt;code&gt;at interface limits? or use nicstat&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;sar -n TCP,ETCP 1 &lt;code&gt;active/passive load, retransmit rate&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;cat /etc/resolv.conf &lt;code&gt;it&#39;s always DNS&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;mpstat -P ALL 1 &lt;code&gt;high kernel time? single hot CPU?&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;tcpretrans &lt;code&gt;what are the retransmits? state?&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;tcpconnect &lt;code&gt;connecting to anything unexpected?&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;tcpaccept &lt;code&gt;unexpected workload?&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;netstat -rnv &lt;code&gt;any inefficient routes?&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;check firewall config &lt;code&gt;anything blocking/throttling?&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;netstat -s &lt;code&gt;play 252 metric pickup&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;linux-cpu-checklist&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#linux-cpu-checklist&quot; aria-label=&quot;Anchor link for: linux-cpu-checklist&quot;&gt;🔗&lt;/a&gt;Linux CPU Checklist&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;uptime &lt;code&gt;load averages&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;vmstat 1 &lt;code&gt;system-wide utilization, run q length&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;mpstat -P ALL 1 &lt;code&gt;CPU balance&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;pidstat 1 &lt;code&gt;per-process CPU&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;CPU flame graph &lt;code&gt;CPU profiling&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;CPU subsecond offset heat map &lt;code&gt;look for gaps&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;perf stat -a -- sleep 10 &lt;code&gt;IPC, LLC hit ratio&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;https://nbari.com/post/observability-tools/&lt;/p&gt;
&lt;div class=&quot;video-embed&quot;&gt;
    &lt;iframe src=&quot;https://www.youtube-nocookie.com/embed/zxCWXNigDpA&quot; title=&quot;YouTube video&quot; loading=&quot;lazy&quot; allow=&quot;accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen&gt;&lt;/iframe&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;Thanks to Brendan Gregg&#39;s for all this info http://www.brendangregg.com/
http://www.brendangregg.com/blog/2016-05-04/srecon2016-perf-checklists-for-sres.html&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The Realities of the Job of Delivering Reliability&lt;/p&gt;
&lt;div class=&quot;video-embed&quot;&gt;
    &lt;iframe src=&quot;https://www.youtube-nocookie.com/embed/Lf4RwlOdppg&quot; title=&quot;YouTube video&quot; loading=&quot;lazy&quot; allow=&quot;accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen&gt;&lt;/iframe&gt;
&lt;/div&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>forward proxy</title>
        <published>2017-01-21T17:42:07+01:00</published>
        <updated>2017-01-21T17:42:07+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/forward-proxy/"/>
        <id>https://nbari.com/forward-proxy/</id>
        
        <content type="html" xml:base="https://nbari.com/forward-proxy/">&lt;h1 id=&quot;nginx-forward-proxy&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#nginx-forward-proxy&quot; aria-label=&quot;Anchor link for: nginx-forward-proxy&quot;&gt;🔗&lt;/a&gt;nginx forward proxy&lt;/h1&gt;
&lt;p&gt;Server configuration:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;server {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    listen       8080;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    location / {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        resolver 8.8.8.8;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        proxy_pass http://$http_host$uri$is_args$args;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    error_page   500 502 503 504  /50x.html;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    location = /50x.html {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        root   /usr/local/www/nginx-dist;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;client-side&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#client-side&quot; aria-label=&quot;Anchor link for: client-side&quot;&gt;🔗&lt;/a&gt;Client side&lt;/h2&gt;
&lt;p&gt;On the browser configure the &lt;code&gt;HTTP Proxy&lt;/code&gt; and port.&lt;/p&gt;
&lt;p&gt;Test by checking the the IP: https://trackip.net&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>leap second</title>
        <published>2017-01-11T15:08:31+01:00</published>
        <updated>2017-01-11T15:08:31+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/leap-seconds/"/>
        <id>https://nbari.com/leap-seconds/</id>
        
        <content type="html" xml:base="https://nbari.com/leap-seconds/">&lt;p&gt;A leap second is an ad-hoc one-second correction to synchronize atomic timescales with Earth rotation.&lt;/p&gt;
&lt;p&gt;It is possible to test whether a leap second will be used. Due to the nature
of NTP, the test might work up to 24 hours before the leap second. Some major
reference clock sources only announce leap seconds one hour ahead of the event.
Query the NTP daemon:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ntpq -c &amp;#39;rv 0 leap&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To update/sync:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ntpdate -v -b pool.ntp.org&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;probably you will need to stop ntpd /etc/rc.d/ntpd stop&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Use ntpq to see more info:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ntpq -p&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>vm tools</title>
        <published>2016-12-19T14:39:36+01:00</published>
        <updated>2016-12-19T14:39:36+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/vm-tools/"/>
        <id>https://nbari.com/vm-tools/</id>
        
        <content type="html" xml:base="https://nbari.com/vm-tools/">&lt;h1 id=&quot;vmware-tools-guest-freebsd&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#vmware-tools-guest-freebsd&quot; aria-label=&quot;Anchor link for: vmware-tools-guest-freebsd&quot;&gt;🔗&lt;/a&gt;vmware tools guest FreeBSD&lt;/h1&gt;
&lt;p&gt;While running FreeBSD as a guest on VMWARE the vm-tools can be installed with this:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ pkg install open-vm-tools-nox11&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Later enable them on &lt;code&gt;/etc/rc.conf&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;vmware_guest_vmblock_enable&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;YES&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;vmware_guest_vmhgfs_enable&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;YES&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;vmware_guest_vmmemctl_enable&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;YES&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;vmware_guest_vmxnet_enable&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;YES&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;vmware_guestd_enable&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;YES&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>scale</title>
        <published>2016-12-18T11:09:35+01:00</published>
        <updated>2016-12-18T11:09:35+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/scale/"/>
        <id>https://nbari.com/scale/</id>
        
        <content type="html" xml:base="https://nbari.com/scale/">&lt;h2 id=&quot;scale-out-horizontal-scaling&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#scale-out-horizontal-scaling&quot; aria-label=&quot;Anchor link for: scale-out-horizontal-scaling&quot;&gt;🔗&lt;/a&gt;scale out (horizontal scaling)&lt;/h2&gt;
&lt;p&gt;Refers to adding more servers with less processors and RAM. This is
usually cheaper overall and can literally scale infinitely&lt;/p&gt;
&lt;p&gt;Pros:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Much cheaper than scaling vertically&lt;/li&gt;
&lt;li&gt;Easier to run fault-tolerance&lt;/li&gt;
&lt;li&gt;Easy to upgrade&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Cons:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Bigger footprint in the Data Center&lt;/li&gt;
&lt;li&gt;Higher utility cost (Electricity and cooling)&lt;/li&gt;
&lt;li&gt;Possible need for more networking equipment (switches/routers)&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;scale-in-vertical-scaling&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#scale-in-vertical-scaling&quot; aria-label=&quot;Anchor link for: scale-in-vertical-scaling&quot;&gt;🔗&lt;/a&gt;scale in (vertical scaling)&lt;/h2&gt;
&lt;p&gt;Refers to adding more processors and RAM, buying a more expensive and robust
server.&lt;/p&gt;
&lt;p&gt;Pros:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Less power consumption than running multiple servers&lt;/li&gt;
&lt;li&gt;Generally less challenging to implement&lt;/li&gt;
&lt;li&gt;Uses less network hardware than scaling horizontally&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Cons:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Price&lt;/li&gt;
&lt;li&gt;Greater risk of hardware failure causing bigger outages&lt;/li&gt;
&lt;li&gt;Generally severe vendor lock-in and limited upgradeability in the future&lt;/li&gt;
&lt;/ul&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>zfs</title>
        <published>2016-12-10T15:53:08+01:00</published>
        <updated>2016-12-10T15:53:08+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/zfs/"/>
        <id>https://nbari.com/zfs/</id>
        
        <content type="html" xml:base="https://nbari.com/zfs/">&lt;h1 id=&quot;freebsd-zfs-disk-image&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#freebsd-zfs-disk-image&quot; aria-label=&quot;Anchor link for: freebsd-zfs-disk-image&quot;&gt;🔗&lt;/a&gt;FreeBSD zfs disk image&lt;/h1&gt;
&lt;p&gt;Use &lt;a rel=&quot;external&quot; href=&quot;https://www.virtualbox.org/&quot;&gt;VirtualBox&lt;/a&gt; to install
&lt;a rel=&quot;external&quot; href=&quot;https://www.freebsd.org/where.html&quot;&gt;FreeBSD&lt;/a&gt; using UFS.&lt;/p&gt;
&lt;p&gt;After having FreeBSD installed, update your sources and build a custom world and
kernel based on your needs for the new image to be created:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# cd /usr/src&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# make -j4 buildworld buildkernel&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;adjust -j4 to the number or cpu cores&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Use this script to create the image: https://github.com/nbari/freebsd/blob/master/zfs/zfs.sh&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ mkdir /raw &amp;amp;&amp;amp; cd /raw&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ fetch --no-verify-peer https://raw.githubusercontent.com/nbari/freebsd/master/zfs/zfs.sh&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ ./zfs.sh&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If everything runs fine, on new files of 1GB size called &lt;code&gt;disk.raw&lt;/code&gt; will be
created.&lt;/p&gt;
&lt;p&gt;To test your image in virtualbox, download the disk.raw and convert it to &lt;code&gt;VDI&lt;/code&gt; format:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ VBoxManage convertfromraw disk.raw ec2.vdi --format VDI&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Since the disk is only 1GB, you may want to increase the size, this can be done
like this:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ VBoxManage modifyhd disk.vdi --resize 8192&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;After booting the pool need to be increased:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ gpart show da0&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Example of output:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;root@/:~&lt;/span&gt;&lt;span class=&quot;z-1 z-i&quot;&gt; # gpart show&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;=&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;       40  503316400&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;  da0  GPT&lt;/span&gt;&lt;span&gt;  (240G)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;         40&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;       1024    1&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;  freebsd-boot&lt;/span&gt;&lt;span&gt;  (512K)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;       1064&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;    2097152    2&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;  freebsd-swap&lt;/span&gt;&lt;span&gt;  (1.0G)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;    2098216&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;        984&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;       - free -&lt;/span&gt;&lt;span&gt;  (492K)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;    2099200&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;    2093056    3&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;  freebsd-zfs&lt;/span&gt;&lt;span&gt;  (1.0G)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;    4192256&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;  499124184&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;       - free -&lt;/span&gt;&lt;span&gt;  (1.0M)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then type &lt;code&gt;gpart recover da0&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ gpart recover da0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;da0 recovered&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And next resize &lt;code&gt;gpart resize -i 3 da0&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ gpart resize -i 3 da0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;da0 resized&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;-i 3,  3 is the freebsd-zfs&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;After resizing:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;root@/:~&lt;/span&gt;&lt;span class=&quot;z-1 z-i&quot;&gt; # gpart show&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;=&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;       40  503316400&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;  da0  GPT&lt;/span&gt;&lt;span&gt;  (240G)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;         40&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;       1024    1&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;  freebsd-boot&lt;/span&gt;&lt;span&gt;  (512K)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;       1064&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;    2097152    2&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;  freebsd-swap&lt;/span&gt;&lt;span&gt;  (1.0G)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;    2098216&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;        984&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;       - free -&lt;/span&gt;&lt;span&gt;  (492K)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;    2099200&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;  501217240    3&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;  freebsd-zfs&lt;/span&gt;&lt;span&gt;  (239G)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Get zpool information by typing:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ zdb&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Find the children guid from the output:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;zroot -&amp;gt; vdev_tree -&amp;gt; children[0] -&amp;gt; guid&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;root@:/raw&lt;/span&gt;&lt;span class=&quot;z-1 z-i&quot;&gt; # zdb&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;zroot:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;    version:&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 5000&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;    name:&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;#39;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;zroot&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;    state:&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;    txg:&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 422&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;    pool_guid:&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 5388488397555579451&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;    hostid:&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 4037738314&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;    hostname:&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;#39;&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;    com.delphix:has_per_vdev_zaps&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;    vdev_children:&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;    vdev_tree:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;        type&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;#39;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;root&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;        id:&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;        guid:&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 5388488397555579451&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;        create_txg:&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 4&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;        children[0]:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;            type&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;#39;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;disk&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;            id:&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;            guid:&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 2304114010935459478&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;            path:&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;#39;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;/dev/gpt/disk0&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;            whole_disk:&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;            metaslab_array:&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 37&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;            metaslab_shift:&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 24&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;            ashift:&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 12&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;            asize:&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 8584429568&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;            is_log:&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;            create_txg:&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 4&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;            com.delphix:vdev_zap_leaf:&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 35&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;            com.delphix:vdev_zap_top:&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 36&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;    features_for_read:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;        com.delphix:hole_birth&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;        com.delphix:embedded_data&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Resize the pool:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ zpool online -e zroot 2304114010935459478&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Check the pool:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;root@:/raw&lt;/span&gt;&lt;span class=&quot;z-1 z-i&quot;&gt; # zpool list&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;NAME&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;    SIZE  ALLOC   FREE  EXPANDSZ   FRAG    CAP  DEDUP  HEALTH  ALTROOT&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;zroot&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;  7.98G   258M  7.73G         -     2%     3%  1.00x  ONLINE  -&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;readonly-off&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#readonly-off&quot; aria-label=&quot;Anchor link for: readonly-off&quot;&gt;🔗&lt;/a&gt;readonly=off&lt;/h2&gt;
&lt;p&gt;Set the &lt;code&gt;/&lt;/code&gt; to readonly off:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ zfs set readonly=off zroot/ROOT/default&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>forkbomb</title>
        <published>2016-12-08T11:11:36+01:00</published>
        <updated>2016-12-08T11:11:36+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/forkbomb/"/>
        <id>https://nbari.com/forkbomb/</id>
        
        <content type="html" xml:base="https://nbari.com/forkbomb/">&lt;h1 id=&quot;forkbomb&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#forkbomb&quot; aria-label=&quot;Anchor link for: forkbomb&quot;&gt;🔗&lt;/a&gt;forkbomb&lt;/h1&gt;
&lt;p&gt;C example:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;c&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;#include&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;lt;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;stdio.h&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-8&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt; main&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;() {&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt; while&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt; fork&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;(); }&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To compile:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ clang bomg.c&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Python example:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;import&lt;/span&gt;&lt;span&gt; os&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;while&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; True:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    os&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt;fork&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;()&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;How to prevent it, use &lt;a rel=&quot;external&quot; href=&quot;https://www.freebsd.org/doc/handbook/security-resourcelimits.html&quot;&gt;RCTL&lt;/a&gt;
for example in a jail:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ rctl -a jail:myJail:maxproc:deny=50&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>ssmtp</title>
        <published>2016-12-06T22:50:47+01:00</published>
        <updated>2016-12-06T22:50:47+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/ssmtp/"/>
        <id>https://nbari.com/ssmtp/</id>
        
        <content type="html" xml:base="https://nbari.com/ssmtp/">&lt;h1 id=&quot;ssmtp-send-a-message-using-smtp&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#ssmtp-send-a-message-using-smtp&quot; aria-label=&quot;Anchor link for: ssmtp-send-a-message-using-smtp&quot;&gt;🔗&lt;/a&gt;ssmtp - send a message using smtp&lt;/h1&gt;
&lt;p&gt;When having sendmail disabled:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sendmail_enable=&amp;quot;NONE&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://wiki.archlinux.org/index.php/SSMTP&quot;&gt;ssmtp&lt;/a&gt; helps to send email using an
SMTP server:&lt;/p&gt;
&lt;p&gt;Install ssmtp:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pkg install ssmtp&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Configure to use you provider &lt;a rel=&quot;external&quot; href=&quot;https://www.mailgun.com/&quot;&gt;mailgun&lt;/a&gt; in this
example &lt;code&gt;/usr/local/etc/ssmtp/ssmtp.conf&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;root&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;monitor@domain.tld&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mailhub&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;smtp.mailgun.org&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;AuthUser&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;postmaster@your.domain&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;AuthPass&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;yourpassword&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;UseTLS&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;Yes&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;UseSTARTTLS&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;YES&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;FromLineOverride&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;YES&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Edit &lt;code&gt;/etc/mail/mailer.conf&lt;/code&gt; to use ssmtp:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;sendmail&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;        /usr/local/sbin/ssmtp&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;send-mail&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;       /usr/local/sbin/ssmtp&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;mailq&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;           /usr/local/sbin/ssmtp&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;newaliases&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;      /usr/local/sbin/ssmtp&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;hoststat&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;        /usr/bin/&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;true&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;purgestat&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;       /usr/bin/&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;true&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now all email sent to &lt;code&gt;root&lt;/code&gt; will be sent to &lt;code&gt;monitor@domain.tld&lt;/code&gt; for example to
email the current kernel options:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sysctl kern.conftxt | mail root&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>lshw</title>
        <published>2016-12-04T14:06:25+01:00</published>
        <updated>2016-12-04T14:06:25+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/lshw/"/>
        <id>https://nbari.com/lshw/</id>
        
        <content type="html" xml:base="https://nbari.com/lshw/">&lt;p&gt;To print information about your Linux system hardware, run this command.&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; $ apt-get install lshw&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;lshw&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#lshw&quot; aria-label=&quot;Anchor link for: lshw&quot;&gt;🔗&lt;/a&gt;lshw&lt;/h2&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;root@server:/#&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; lshw -short&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;H/W&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; path        Device      Class      Description&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;==================================================&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;                            system&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;     Computer&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;/0&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;                          bus        Motherboard&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;/0/0&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;                        memory     3020MiB System memory&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;/0/1&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;                        processor  Intel&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;R&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; Xeon&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;R&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; CPU E5-2660 v3 @ 2.60GHz&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;/0/2&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;                        processor  Intel&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;R&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; Xeon&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;R&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; CPU E5-2660 v3 @ 2.60GHz&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;/0/100&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;                      bridge     440FX - 82441FX PMC&lt;/span&gt;&lt;span&gt; [Natoma]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;/0/100/1&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;                    bridge     82371SB PIIX3 ISA&lt;/span&gt;&lt;span&gt; [Natoma/Triton&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; II]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;/0/100/1.1&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;                  storage    82371SB PIIX3 IDE&lt;/span&gt;&lt;span&gt; [Natoma/Triton&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; II]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;/0/100/1.2&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;                  bus        82371SB PIIX3 USB&lt;/span&gt;&lt;span&gt; [Natoma/Triton&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; II]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;/0/100/1.2/1&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;    usb1        bus        UHCI Host Controller&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;/0/100/1.2/1/1&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;              input      QEMU USB Tablet&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;/0/100/1.3&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;                  bridge     82371AB/EB/MB PIIX4 ACPI&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;/0/100/2&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;                    display    GD&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 5446&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;/0/100/3&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;        eth0        network    Virtio network device&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;/0/100/4&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;                    storage    Virtio SCSI&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;/0/100/5&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;                    generic    Virtio memory balloon&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;/0/3&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;            scsi2       storage&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;/0/3/0.0.0&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;      /dev/sda    disk       257GB SCSI Disk&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;/0/3/0.0.0/1&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;    /dev/sda1   volume     9748KiB data partition&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;/0/3/0.0.0/2&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;    /dev/sda2   volume     3899MiB Linux swap volume&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;/0/3/0.0.0/3&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;    /dev/sda3   volume     236GiB EXT4 volume&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;/0/4&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;            scsi1       storage&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;/0/4/0.0.0&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;      /dev/cdrom  disk       DVD reader&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;lscpu&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#lscpu&quot; aria-label=&quot;Anchor link for: lscpu&quot;&gt;🔗&lt;/a&gt;lscpu&lt;/h2&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;root@server:/#&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; lscpu&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;Architecture:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;          x86_64&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;CPU&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; op-mode&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;:        32-bit, 64-bit&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;Byte&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; Order:            Little Endian&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;CPU(s&lt;/span&gt;&lt;span&gt;):                2&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;On-line&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; CPU&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; list:   0,1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;Thread(s&lt;/span&gt;&lt;span&gt;) per core:    1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;Core(s&lt;/span&gt;&lt;span&gt;) per socket:    1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;Socket(s&lt;/span&gt;&lt;span&gt;):             2&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;NUMA&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; node&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;          1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;Vendor&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; ID:             GenuineIntel&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;CPU&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; family:&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;            6&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;Model:&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;                 63&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;Model&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; name:            Intel&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;R&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; Xeon&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;R&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; CPU E5-2660 v3 @ 2.60GHz&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;Stepping:&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;              2&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;CPU&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; MHz:&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;               2596.988&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;BogoMIPS:&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;              5193.97&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;Hypervisor&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; vendor:     KVM&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;Virtualization&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; type:   full&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;L1d&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; cache:             32K&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;L1i&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; cache:             32K&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;L2&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; cache:              256K&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;L3&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; cache:              25600K&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;NUMA&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; node0 CPU&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;:     0,1&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;lsblk&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#lsblk&quot; aria-label=&quot;Anchor link for: lsblk&quot;&gt;🔗&lt;/a&gt;lsblk&lt;/h2&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;root@server:/#&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; lsblk&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;NAME&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;sda&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;      8:0&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;    0&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;   240G&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;  0&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; disk&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;-sda1&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;   8:1&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;    0&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;   9.5M&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;  0&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; part&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;-sda2&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;   8:2&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;    0&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;   3.8G&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;  0&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; part&lt;/span&gt;&lt;span&gt; [SWAP]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;-sda3&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;   8:3&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;    0&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; 236.2G&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;  0&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; part /&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;sr0&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;     11:0&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;    1&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;  1024M&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;  0&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; rom&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>vps</title>
        <published>2016-12-04T12:57:26+01:00</published>
        <updated>2016-12-04T12:57:26+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/vps/"/>
        <id>https://nbari.com/vps/</id>
        
        <content type="html" xml:base="https://nbari.com/vps/">&lt;p&gt;VPS providers that allow use your own image/kernel&lt;/p&gt;
&lt;h2 id=&quot;google-cloud-only-ipv4&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#google-cloud-only-ipv4&quot; aria-label=&quot;Anchor link for: google-cloud-only-ipv4&quot;&gt;🔗&lt;/a&gt;Google cloud (only ipv4)&lt;/h2&gt;
&lt;p&gt;Allows to upload compreses raw images:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;tar --format=gnutar -Szcf disk.tar.gz disk.raw&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://en.wikipedia.org/wiki/Maximum_transmission_unit&quot;&gt;MTU&lt;/a&gt;
needs to be set to 1460 and in some cases disable the
&lt;a href=&quot;/post/checksum-offload/&quot;&gt;checksum offload&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&quot;amazon-aws-only-ipv4&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#amazon-aws-only-ipv4&quot; aria-label=&quot;Anchor link for: amazon-aws-only-ipv4&quot;&gt;🔗&lt;/a&gt;Amazon AWS (only ipv4)&lt;/h2&gt;
&lt;p&gt;Images can&#39;t be uploaded compressed, ans disabling &lt;a rel=&quot;external&quot; href=&quot;https://en.wikipedia.org/wiki/Large_segment_offload&quot;&gt;TSO&lt;/a&gt; is required:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ifconfig_DEFAULT=&amp;quot;SYNCDHCP -tso&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h1 id=&quot;ipv6-support&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#ipv6-support&quot; aria-label=&quot;Anchor link for: ipv6-support&quot;&gt;🔗&lt;/a&gt;IPV6 support&lt;/h1&gt;
&lt;h2 id=&quot;vultr&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#vultr&quot; aria-label=&quot;Anchor link for: vultr&quot;&gt;🔗&lt;/a&gt;vultr&lt;/h2&gt;
&lt;p&gt;https://www.vultr.com/&lt;/p&gt;
&lt;p&gt;Instead of uploading the raw images, they will be fetched, a URL needs to be
provider from where the image can be downloaded.&lt;/p&gt;
&lt;h2 id=&quot;netcup-avoid-warning&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#netcup-avoid-warning&quot; aria-label=&quot;Anchor link for: netcup-avoid-warning&quot;&gt;🔗&lt;/a&gt;netcup (avoid ⚠️ )&lt;/h2&gt;
&lt;p&gt;https://www.netcup.eu/&lt;/p&gt;
&lt;p&gt;Very good prices, Images need to be uploaded via FTP.&lt;/p&gt;
&lt;p&gt;There is an issue while rebooting instances due a bug on QEMU/KVM.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;https://redmine.pfsense.org/issues/4377&lt;/li&gt;
&lt;li&gt;https://bugs.launchpad.net/qemu/+bug/1329956&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To replicate once login is up and running just reboot and later will stuck in
the booting process like this:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/img/usbus0-netcup.png&quot; alt=&quot;usb2-netcup&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;&lt;/p&gt;
&lt;p&gt;To fix this, the virtual machine needs to be moved to another updated server.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;headsup about German Provider Policies&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id=&quot;lunanode&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#lunanode&quot; aria-label=&quot;Anchor link for: lunanode&quot;&gt;🔗&lt;/a&gt;lunanode&lt;/h2&gt;
&lt;p&gt;https://lunanode.com&lt;/p&gt;
&lt;p&gt;Similar to netcup but only IPv4 and with &quot;Floating IPs&quot;&lt;/p&gt;
&lt;p&gt;Images need to be in QCOW2 format&lt;/p&gt;
&lt;h1 id=&quot;script-to-create-images&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#script-to-create-images&quot; aria-label=&quot;Anchor link for: script-to-create-images&quot;&gt;🔗&lt;/a&gt;script to create images:&lt;/h1&gt;
&lt;p&gt;https://fabrik.red&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>ipv6 off</title>
        <published>2016-12-02T14:52:37+01:00</published>
        <updated>2016-12-02T14:52:37+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/ipv6-off/"/>
        <id>https://nbari.com/ipv6-off/</id>
        
        <content type="html" xml:base="https://nbari.com/ipv6-off/">&lt;h1 id=&quot;turn-off-ipv6-on-mac&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#turn-off-ipv6-on-mac&quot; aria-label=&quot;Anchor link for: turn-off-ipv6-on-mac&quot;&gt;🔗&lt;/a&gt;Turn off IPv6 on mac&lt;/h1&gt;
&lt;p&gt;First list interfaces:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ networksetup -listallnetworkservices&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;An asterisk (*) denotes that a network service is disabled.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Thunderbolt Ethernet&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Wi-Fi&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Bluetooth PAN&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Thunderbolt Bridge&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Next:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; networksetup -setv6off&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;Thunderbolt Ethernet&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;For Wi-Fi:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; networksetup -setv6off  Wi-Fi&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>ipv6 tunnelbroker</title>
        <published>2016-12-01T16:50:30+01:00</published>
        <updated>2016-12-01T16:50:30+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/ipv6-tunnelbroker/"/>
        <id>https://nbari.com/ipv6-tunnelbroker/</id>
        
        <content type="html" xml:base="https://nbari.com/ipv6-tunnelbroker/">&lt;h1 id=&quot;6in4&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#6in4&quot; aria-label=&quot;Anchor link for: 6in4&quot;&gt;🔗&lt;/a&gt;6in4&lt;/h1&gt;
&lt;blockquote&gt;
&lt;p&gt;6in4 uses tunneling to encapsulate IPv6 traffic over explicitly-configured
IPv4 links. The 6in4 traffic is sent over the IPv4 Internet inside IPv4 packets
whose IP headers have the IP protocol number set to 41.
https://en.wikipedia.org/wiki/6in4&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;img src=&quot;/img/6in4.gif&quot; alt=&quot;6in4&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;&lt;/p&gt;
&lt;p&gt;&quot;6to4&quot; is a tunneling method that is only interesting for reaching IPv6-only
services. And 6to4 makes sense only if one has a public IPv4 address. As a rule,
you only need to enable &quot;6to4&quot; if you want to access services that are only
IPv6. http://www.elektronik-kompendium.de/sites/net/1904031.htm&lt;/p&gt;
&lt;p&gt;Create an account on https://tunnelbroker.net/&lt;/p&gt;
&lt;h1 id=&quot;seting-ip-on-freebsd&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#seting-ip-on-freebsd&quot; aria-label=&quot;Anchor link for: seting-ip-on-freebsd&quot;&gt;🔗&lt;/a&gt;seting IP on FreeBSD&lt;/h1&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ifconfig gif0 create&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ifconfig gif0 tunnel 1.2.3.4 Y.Y.Y.Y&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ifconfig gif0 inet6 2001:470:1c:35e::2&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;route -n add -inet6 default 2001:470:1c:35e::1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ifconfig gif0 up&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Where &lt;code&gt;Y.Y.Y.Y&lt;/code&gt; is the Server IPv4 Address and &lt;code&gt;1.2.3.4&lt;/code&gt; is your lan.&lt;/p&gt;
&lt;h1 id=&quot;mac-os-x-setup&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#mac-os-x-setup&quot; aria-label=&quot;Anchor link for: mac-os-x-setup&quot;&gt;🔗&lt;/a&gt;mac os X setup&lt;/h1&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ifconfig gif0 create&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ifconfig gif0 tunnel 56.189.27.100 216.77.86.114&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ifconfig gif0 inet6 2001:470:6c:387::2 2001:470:6c:387::1 prefixlen 128&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;route -n add -inet6 default 2001:470:6c:387::1&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>postgres</title>
        <published>2016-11-30T17:12:04+01:00</published>
        <updated>2016-11-30T17:12:04+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/postgres/"/>
        <id>https://nbari.com/postgres/</id>
        
        <content type="html" xml:base="https://nbari.com/postgres/">&lt;h1 id=&quot;read-only-user&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#read-only-user&quot; aria-label=&quot;Anchor link for: read-only-user&quot;&gt;🔗&lt;/a&gt;Read only user&lt;/h1&gt;
&lt;p&gt;Create user first:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;CREATE USER theuser WITH PASSWORD &amp;#39;secret&amp;#39;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;GRANT SELECT ON ALL TABLES IN SCHEMA public TO theuser;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;GRANT CONNECT ON DATABASE mydb TO dbuser;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Test:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;psql -h host -U theuser mydb&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To see the list of tables:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mydb=&amp;gt;\d+&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>checksum offload</title>
        <published>2016-11-29T19:15:23+01:00</published>
        <updated>2016-11-29T19:15:23+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/checksum-offload/"/>
        <id>https://nbari.com/checksum-offload/</id>
        
        <content type="html" xml:base="https://nbari.com/checksum-offload/">&lt;h1 id=&quot;tcp-offload-engine&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#tcp-offload-engine&quot; aria-label=&quot;Anchor link for: tcp-offload-engine&quot;&gt;🔗&lt;/a&gt;TCP offload engine&lt;/h1&gt;
&lt;blockquote&gt;
&lt;p&gt;TOE is a technology used in network interface cards
(NIC) to offload processing of the entire TCP/IP stack to the network
controller. It is primarily used with high-speed network interfaces, such as
gigabit Ethernet and 10 Gigabit Ethernet, where processing overhead of the
network stack becomes significant. https://en.wikipedia.org/wiki/TCP_offload_engine&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;On Virtual Guest disabling the cheksum may boost the newtork speed, for example
on &lt;a rel=&quot;external&quot; href=&quot;https://cloud.google.com/compute-engine&quot;&gt;GCE&lt;/a&gt; when using FreeBSD add this
to the &lt;code&gt;/boot/loader.conf&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;hw.vtnet.csum_disable=&amp;quot;1&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This will make the network speed faster but will consume more CPU.&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>cdn token</title>
        <published>2016-11-22T12:43:16+01:00</published>
        <updated>2016-11-22T12:43:16+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/cdn-token/"/>
        <id>https://nbari.com/cdn-token/</id>
        
        <content type="html" xml:base="https://nbari.com/cdn-token/">&lt;h1 id=&quot;restrict-access-only-to-the-cdn-cloudfront&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#restrict-access-only-to-the-cdn-cloudfront&quot; aria-label=&quot;Anchor link for: restrict-access-only-to-the-cdn-cloudfront&quot;&gt;🔗&lt;/a&gt;Restrict access only to the CDN (cloudfront)&lt;/h1&gt;
&lt;p&gt;To only allow, handle request from the CDN you could add a custom header/token
and check on your backend (nginx/haproxy) if is matching otherwise return a 401&lt;/p&gt;
&lt;p&gt;If using AWS cloudfront you edit your origins like this:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/img/x-cf-token.png&quot; alt=&quot;cloudfront x-cf-token&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;&lt;/p&gt;
&lt;p&gt;The token can be any UUID / has or common secret between the CDN and the
backend.&lt;/p&gt;
&lt;p&gt;If your backends are using nginx you could verify the token like this:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;server {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	listen 80;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	server_name _;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	if ($http_x_cf_token != &amp;#39;4147E877-7C6D-4B4E-96CE-B173B6F0B755&amp;#39;) {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		return 401;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	...&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In this case the token is an UUID and if the request come with no token they
will got a 401.&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>observability tools</title>
        <published>2016-11-14T18:45:50+01:00</published>
        <updated>2016-11-14T18:45:50+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/observability-tools/"/>
        <id>https://nbari.com/observability-tools/</id>
        
        <content type="html" xml:base="https://nbari.com/observability-tools/">&lt;h1 id=&quot;freebsd&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#freebsd&quot; aria-label=&quot;Anchor link for: freebsd&quot;&gt;🔗&lt;/a&gt;FreeBSD&lt;/h1&gt;
&lt;p&gt;&lt;img src=&quot;/img/freebsd_observability_tools.png&quot; alt=&quot;FreeBSD observability tools&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;&lt;/p&gt;
&lt;h1 id=&quot;linux&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#linux&quot; aria-label=&quot;Anchor link for: linux&quot;&gt;🔗&lt;/a&gt;Linux&lt;/h1&gt;
&lt;p&gt;&lt;img src=&quot;/img/linux_observability_tools.png&quot; alt=&quot;Linux observability tools&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/img/linux_perf_tools_full.svg&quot; alt=&quot;linux perf tools&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;&lt;/p&gt;
&lt;p&gt;src: http://www.brendangregg.com/blog/2015-03-06/performance-analysis-bsd.html&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>innodb_flush_log_at_trx_commit=2</title>
        <published>2016-11-14T11:57:34+01:00</published>
        <updated>2016-11-14T11:57:34+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/mysql-innodb-flush-log-at-trx-commit/"/>
        <id>https://nbari.com/mysql-innodb-flush-log-at-trx-commit/</id>
        
        <content type="html" xml:base="https://nbari.com/mysql-innodb-flush-log-at-trx-commit/">&lt;p&gt;To speed mysql replica add into the &lt;code&gt;[mysqld]&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;innodb_flush_log_at_trx_commit=2&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>mysql_tzinfo_to_sql</title>
        <published>2016-11-07T16:58:24+01:00</published>
        <updated>2016-11-07T16:58:24+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/mysql-tzinfo-to-sql/"/>
        <id>https://nbari.com/mysql-tzinfo-to-sql/</id>
        
        <content type="html" xml:base="https://nbari.com/mysql-tzinfo-to-sql/">&lt;h1 id=&quot;freebsd-mysql-utc&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#freebsd-mysql-utc&quot; aria-label=&quot;Anchor link for: freebsd-mysql-utc&quot;&gt;🔗&lt;/a&gt;FreeBSD &amp;amp; MySQL UTC&lt;/h1&gt;
&lt;p&gt;After doing a fresh install, load the UTC zone:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ cd /usr/share/zoneinfo&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ mysql_tzinfo_to_sql  UTC UTC | mysql -u root mysql&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Edit the &lt;code&gt;/etc/my.cnf&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[mysqld]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;default-time-zone=&amp;#39;UTC&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This will set the default timezone on the server to be &lt;code&gt;UTC&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;To get current timezone of the mysql you can do following things:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mysql&amp;gt; SELECT @@global.time_zone, @@session.time_zone;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>convertfromraw</title>
        <published>2016-11-07T16:20:26+01:00</published>
        <updated>2016-11-07T16:20:26+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/convertfromraw/"/>
        <id>https://nbari.com/convertfromraw/</id>
        
        <content type="html" xml:base="https://nbari.com/convertfromraw/">&lt;h1 id=&quot;convert-from-raw-to-vdi&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#convert-from-raw-to-vdi&quot; aria-label=&quot;Anchor link for: convert-from-raw-to-vdi&quot;&gt;🔗&lt;/a&gt;Convert from RAW to VDI&lt;/h1&gt;
&lt;p&gt;When creating custom &quot;RAW&quot; images using &lt;a rel=&quot;external&quot; href=&quot;https://www.freebsd.org/cgi/man.cgi?query=mkimg&amp;amp;sektion=1&quot;&gt;mkimg&lt;/a&gt;
they can be use in VirtualBox by converting them to &quot;VDI&quot; format, example:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ VBoxManage convertfromraw ec2.raw ec2.vdi --format VDI&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Converting from raw image file=&amp;quot;ec2.raw&amp;quot; to file=&amp;quot;ec2.vdi&amp;quot;...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Creating dynamic image with size 3221292544 bytes (3073MB)...&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Once the image is in &quot;VDI&quot; format it can be resized using:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ VBoxManage modifyhd ec2.vdi --resize 8192&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The above command will resize the image to 8GB.&lt;/p&gt;
&lt;h2 id=&quot;vmware&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#vmware&quot; aria-label=&quot;Anchor link for: vmware&quot;&gt;🔗&lt;/a&gt;VMware&lt;/h2&gt;
&lt;p&gt;If using VMware, virtual disks can be expanded using this ESXi/ESX command:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;vmkfstools -X &amp;lt;new size&amp;gt; &amp;lt;virtual disk&amp;gt;.vmdk&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;For example, use this command to grow the virtual disk to 25GB in size:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;vmkfstools -X 25g /vmfs/volumes/xxxx/vmname/vmname.vmdk&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>txt 2 img</title>
        <published>2016-11-01T21:00:35+01:00</published>
        <updated>2016-11-01T21:00:35+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/txt2img/"/>
        <id>https://nbari.com/txt2img/</id>
        
        <content type="html" xml:base="https://nbari.com/txt2img/">&lt;p&gt;To create an image with a custom label from the command line:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;convert -font AndaleMono -size 200x32 -gravity center -background white -fill black  label:&amp;quot;0O0ilLxt your msg &amp;quot; out.png&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>transparent</title>
        <published>2016-10-30T17:36:50+01:00</published>
        <updated>2016-10-30T17:36:50+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/transparent/"/>
        <id>https://nbari.com/transparent/</id>
        
        <content type="html" xml:base="https://nbari.com/transparent/">&lt;h1 id=&quot;create-an-image-with-transparent-background&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#create-an-image-with-transparent-background&quot; aria-label=&quot;Anchor link for: create-an-image-with-transparent-background&quot;&gt;🔗&lt;/a&gt;Create an image with transparent background&lt;/h1&gt;
&lt;p&gt;Using convert from imagemagick:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;convert input.jpg -fuzz 10% -transparent white transparent.png&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>webscraping</title>
        <published>2016-10-27T21:37:13+02:00</published>
        <updated>2016-10-27T21:37:13+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/webscraping/"/>
        <id>https://nbari.com/webscraping/</id>
        
        <content type="html" xml:base="https://nbari.com/webscraping/">&lt;h1 id=&quot;webscraping-using-python-chrome&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#webscraping-using-python-chrome&quot; aria-label=&quot;Anchor link for: webscraping-using-python-chrome&quot;&gt;🔗&lt;/a&gt;Webscraping using python + chrome&lt;/h1&gt;
&lt;p&gt;In mac OS X, install chromedriver and selenium:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;brew install chromedriver&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Install selenium via pip:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pip install -U selenium&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;if required to install globally &lt;code&gt;sudo pip install selenium&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;To test, open a terminal, type python and try:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Python 2.7.12 (default, Oct 11 2016, 05:20:59)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.38)] on darwin&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;gt;&amp;gt;&amp;gt; from selenium import webdriver&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;gt;&amp;gt;&amp;gt; driver = webdriver.Chrome()&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;gt;&amp;gt;&amp;gt; driver.get(&amp;quot;https://nbari.com&amp;quot;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h1 id=&quot;scraping&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#scraping&quot; aria-label=&quot;Anchor link for: scraping&quot;&gt;🔗&lt;/a&gt;scraping&lt;/h1&gt;
&lt;p&gt;The following example will do:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Fill a form,&lt;/li&gt;
&lt;li&gt;Parse links of the results.&lt;/li&gt;
&lt;li&gt;Open each link.&lt;/li&gt;
&lt;li&gt;Get text data from a div.&lt;/li&gt;
&lt;li&gt;Go back to step 2 until all links are parsed.&lt;/li&gt;
&lt;/ol&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;from&lt;/span&gt;&lt;span&gt; selenium&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt; import&lt;/span&gt;&lt;span&gt; webdriver&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;from&lt;/span&gt;&lt;span&gt; selenium&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span&gt;webdriver&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span&gt;common&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span&gt;keys&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt; import&lt;/span&gt;&lt;span&gt; Keys&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;driver&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; =&lt;/span&gt;&lt;span&gt; webdriver&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt;Chrome&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;()&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;driver&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;(&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;https://search.cro.ie/company/CompanySearch.aspx&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;inputElement&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; =&lt;/span&gt;&lt;span&gt; driver&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt;find_element_by_id&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;(&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;ctl00_ContentPlaceHolder1_textCompanyName&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;inputElement&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt;send_keys&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;(&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;limo&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;inputElement&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt;send_keys&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt;Keys&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;ENTER&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;links&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; =&lt;/span&gt;&lt;span&gt; driver&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt;find_elements_by_xpath&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;(&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;//*[@id=&amp;#39;ctl00_ContentPlaceHolder1_GridView1&amp;#39;]/tbody/tr/td/a&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;data&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; = {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;for&lt;/span&gt;&lt;span&gt; i&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt; in&lt;/span&gt;&lt;span&gt; xrange&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt; len&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt;links&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;)):&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    links&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; =&lt;/span&gt;&lt;span&gt; driver&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt;find_elements_by_xpath&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;(&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;//*[@id=&amp;#39;ctl00_ContentPlaceHolder1_GridView1&amp;#39;]/tbody/tr/td/a&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    idx_name&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; =&lt;/span&gt;&lt;span&gt; links&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;[&lt;/span&gt;&lt;span&gt;i&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;text&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    links&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;[&lt;/span&gt;&lt;span&gt;i&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt;click&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;()&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    div&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; =&lt;/span&gt;&lt;span&gt; driver&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt;find_element_by_id&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;(&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;companyDetails&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    data&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;[&lt;/span&gt;&lt;span&gt;idx_name&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;] =&lt;/span&gt;&lt;span&gt; div&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;text&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    driver&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt;execute_script&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;(&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;window.history.go(-1)&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;for&lt;/span&gt;&lt;span&gt; key&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;,&lt;/span&gt;&lt;span&gt; value&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt; in&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt; sorted&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt;iteritems&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;()):&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;    print&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; *&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 64&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;    print&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;%s&lt;/span&gt;&lt;span&gt;\n&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;%s&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot; % (&lt;/span&gt;&lt;span&gt;key&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;,&lt;/span&gt;&lt;span&gt; value&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>12 factor</title>
        <published>2016-10-25T20:56:30+02:00</published>
        <updated>2016-10-25T20:56:30+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/12factor/"/>
        <id>https://nbari.com/12factor/</id>
        
        <content type="html" xml:base="https://nbari.com/12factor/">&lt;h1 id=&quot;the-twelve-factors&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#the-twelve-factors&quot; aria-label=&quot;Anchor link for: the-twelve-factors&quot;&gt;🔗&lt;/a&gt;The Twelve Factors&lt;/h1&gt;
&lt;h2 id=&quot;1-codebase&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#1-codebase&quot; aria-label=&quot;Anchor link for: 1-codebase&quot;&gt;🔗&lt;/a&gt;1. Codebase&lt;/h2&gt;
&lt;p&gt;Everything in revision control including environment configuration&lt;/p&gt;
&lt;p&gt;git flow
master - production
develop - staging&lt;/p&gt;
&lt;h2 id=&quot;2-dependencies&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#2-dependencies&quot; aria-label=&quot;Anchor link for: 2-dependencies&quot;&gt;🔗&lt;/a&gt;2. Dependencies&lt;/h2&gt;
&lt;p&gt;Explicitly declare and isolate dependencies&lt;/p&gt;
&lt;h2 id=&quot;3-config&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#3-config&quot; aria-label=&quot;Anchor link for: 3-config&quot;&gt;🔗&lt;/a&gt;3. Config&lt;/h2&gt;
&lt;p&gt;Store config in the environment&lt;/p&gt;
&lt;p&gt;In a twelve-factor app, env vars are granular controls, each fully orthogonal to
other env vars. They are never grouped together as “environments”, but instead
are independently managed for each deploy. This is a model that scales up
smoothly as the app naturally expands into more deploys over its lifetime.&lt;/p&gt;
&lt;h2 id=&quot;4-backing-services&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#4-backing-services&quot; aria-label=&quot;Anchor link for: 4-backing-services&quot;&gt;🔗&lt;/a&gt;4. Backing services&lt;/h2&gt;
&lt;p&gt;Treat backing services as attached resources.&lt;/p&gt;
&lt;p&gt;Anything your application uses as a resource (database, queueing systems, email,
cache) should be referenced with &quot;bindings&quot; to these services.&lt;/p&gt;
&lt;p&gt;Backing services should be called via an API.&lt;/p&gt;
&lt;h2 id=&quot;5-build-release-run&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#5-build-release-run&quot; aria-label=&quot;Anchor link for: 5-build-release-run&quot;&gt;🔗&lt;/a&gt;5. Build, release, run&lt;/h2&gt;
&lt;p&gt;Strictly separate build and run stages&lt;/p&gt;
&lt;p&gt;Don&#39;t compile on production environment.&lt;/p&gt;
&lt;p&gt;Blue/Green Deployments are a rule, not an exception.&lt;/p&gt;
&lt;h2 id=&quot;6-processes&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#6-processes&quot; aria-label=&quot;Anchor link for: 6-processes&quot;&gt;🔗&lt;/a&gt;6. Processes&lt;/h2&gt;
&lt;p&gt;Execute the app as one or more stateless processes&lt;/p&gt;
&lt;p&gt;Some web systems rely on “sticky sessions” – that is, caching user session data
in memory of the app’s process and expecting future requests from the same
visitor to be routed to the same process. Sticky sessions are a violation of
twelve-factor and should never be used or relied upon. Session state data is a
good candidate for a datastore that offers time-expiration, such as Memcached or
Redis.&lt;/p&gt;
&lt;h2 id=&quot;7-port-binding&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#7-port-binding&quot; aria-label=&quot;Anchor link for: 7-port-binding&quot;&gt;🔗&lt;/a&gt;7. Port binding&lt;/h2&gt;
&lt;p&gt;Export services via port binding&lt;/p&gt;
&lt;h2 id=&quot;8-concurrency&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#8-concurrency&quot; aria-label=&quot;Anchor link for: 8-concurrency&quot;&gt;🔗&lt;/a&gt;8. Concurrency&lt;/h2&gt;
&lt;p&gt;Scale out via the process model&lt;/p&gt;
&lt;h2 id=&quot;9-disposability&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#9-disposability&quot; aria-label=&quot;Anchor link for: 9-disposability&quot;&gt;🔗&lt;/a&gt;9. Disposability&lt;/h2&gt;
&lt;p&gt;Maximize robustness with fast startup and graceful shutdown.&lt;/p&gt;
&lt;p&gt;Processes shut down gracefully when they receive a SIGTERM signal from the process manager.&lt;/p&gt;
&lt;h2 id=&quot;10-dev-prod-parity&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#10-dev-prod-parity&quot; aria-label=&quot;Anchor link for: 10-dev-prod-parity&quot;&gt;🔗&lt;/a&gt;10. Dev/prod parity&lt;/h2&gt;
&lt;p&gt;Keep development, staging, and production as similar as possible.&lt;/p&gt;
&lt;p&gt;The twelve-factor app is designed for continuous deployment by keeping the gap
between development and production small.&lt;/p&gt;
&lt;p&gt;Dev MUST == Production in config, but not performance&lt;/p&gt;
&lt;h2 id=&quot;11-logs&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#11-logs&quot; aria-label=&quot;Anchor link for: 11-logs&quot;&gt;🔗&lt;/a&gt;11. Logs&lt;/h2&gt;
&lt;p&gt;Treat logs as event streams&lt;/p&gt;
&lt;p&gt;A twelve-factor app never concerns itself with routing or storage of its output
stream. It should not attempt to write to or manage logfiles. Instead, each
running process writes its event stream, unbuffered, to &lt;code&gt;stdout&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id=&quot;12-admin-processes&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#12-admin-processes&quot; aria-label=&quot;Anchor link for: 12-admin-processes&quot;&gt;🔗&lt;/a&gt;12. Admin processes&lt;/h2&gt;
&lt;p&gt;Run admin/management tasks as one-off processes.&lt;/p&gt;
&lt;p&gt;Twelve-factor strongly favors languages which provide a
&lt;a rel=&quot;external&quot; href=&quot;https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop&quot;&gt;REPL&lt;/a&gt;
shell out of the box, and which make it easy to run one-off scripts. In a local
deploy, developers invoke one-off admin processes by a direct shell command
inside the app’s checkout directory. In a production deploy, developers can
use ssh or other remote command execution mechanism provided by that deploy’s
execution environment to run such a process.&lt;/p&gt;
&lt;div class=&quot;video-embed&quot;&gt;
    &lt;iframe src=&quot;https://www.youtube-nocookie.com/embed/GZ4sAEUMOnM&quot; title=&quot;YouTube video&quot; loading=&quot;lazy&quot; allow=&quot;accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen&gt;&lt;/iframe&gt;
&lt;/div&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>dnsmasq</title>
        <published>2016-09-30T12:27:32+02:00</published>
        <updated>2016-09-30T12:27:32+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/dnsmasq/"/>
        <id>https://nbari.com/dnsmasq/</id>
        
        <content type="html" xml:base="https://nbari.com/dnsmasq/">&lt;h1 id=&quot;dnsmasq-forwarding-zones&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#dnsmasq-forwarding-zones&quot; aria-label=&quot;Anchor link for: dnsmasq-forwarding-zones&quot;&gt;🔗&lt;/a&gt;dnsmasq forwarding zones&lt;/h1&gt;
&lt;p&gt;If you are using &lt;a rel=&quot;external&quot; href=&quot;https://en.wikipedia.org/wiki/Dnsmasq&quot;&gt;dnsmasq&lt;/a&gt;
and need to forward a DNS zone to a specific DNS server,
add this to your &lt;code&gt;/etc/dnsmasq.conf&lt;/code&gt;&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;server=/test/10.10.0.4&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;server=/sopas/10.20.0.4&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If you don&#39;t have the file &lt;code&gt;/etc/dnsmasq.conf&lt;/code&gt; check for directory
&lt;code&gt;/etc/dnsmasq.d&lt;/code&gt; and there create a file named &lt;code&gt;/etc/dnsmasq.d/my-zones&lt;/code&gt;
with the content of your zones&lt;/p&gt;
&lt;p&gt;That means that requests made do &lt;code&gt;*.test&lt;/code&gt; will be forwarded to 10.10.0.4
for &lt;code&gt;*.sopas&lt;/code&gt; to 10.20.0.4 and so on&lt;/p&gt;
&lt;p&gt;In case you have the file &lt;code&gt;/etc/resolv.conf&lt;/code&gt; it probably contains a like this:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;nameserver 127.0.0.1&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;That means that you &quot;probably&quot; you are using dnsmasq.&lt;/p&gt;
&lt;h2 id=&quot;dnsmasq-test&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#dnsmasq-test&quot; aria-label=&quot;Anchor link for: dnsmasq-test&quot;&gt;🔗&lt;/a&gt;dnsmasq --test&lt;/h2&gt;
&lt;p&gt;To check configuration file(s) syntax, execute:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ dnsmasq --test&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;After doing this, you can test by doing a ping or dig, example:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dig @127.0.0.1 my-app.test +short&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;assuming 127.0.0.1 is running dnsmasq&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;To test that your domain can be resolved from the specified DNS&#39;s:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dig @10.10.0.4 domain.test +short&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;A full &lt;code&gt;/etc/dnsmasq.conf&lt;/code&gt; example:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# send &amp;#39;domain=home.lan&amp;#39; in DHCP response so that machines&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# configured through DHCP will come under &amp;#39;home.lan&amp;#39; domain.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;domain=home.lan&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# will not read /etc/resolv.conf to get upsteram nameservers&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;no-resolv&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Tells dnsmasq to forward anything with the domain of test to dns server 10.10.0.4&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;server=/test/10.10.0.4&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# upstream nameserver&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;server=4.2.2.2&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;server=8.8.8.8&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Listen to requests only coming from the local machine&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;listen-address=127.0.0.1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# cache 1000 names&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cache-size=1000&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;find-the-conf-dir&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#find-the-conf-dir&quot; aria-label=&quot;Anchor link for: find-the-conf-dir&quot;&gt;🔗&lt;/a&gt;Find the &lt;code&gt;--conf-dir&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;In some systems the &lt;code&gt;dnsmasq.conf&lt;/code&gt; in not located in &lt;code&gt;/etc/dnsmasq.conf&lt;/code&gt; to find
what &lt;code&gt;--config-dir&lt;/code&gt; is used, you can try to do this:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ ps -ef | grep -i dnsmasq&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;nbody    3655  1056  0 09:00 ?        00:00:00 /usr/sbin/dnsmasq --no-resolv --keep-in-foreground --no-hosts --bind-interfaces --pid-file=/var/run/NetworkManager/dnsmasq.pid --listen-address=127.0.1.1 --cache-size=0 --conf-file=/dev/null --proxy-dnssec --enable-dbus=org.freedesktop.NetworkManager.dnsmasq --conf-dir=/etc/NetworkManager/dnsmasq.d&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In this example the configuration directory is:  &lt;code&gt;--conf-dir=/etc/NetworkManager/dnsmasq.d&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;For getting the command line arguments passed to a running process this can be used:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ ps -fp &amp;lt;pid&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;or  if you have a &lt;a rel=&quot;external&quot; href=&quot;https://en.wikipedia.org/wiki/Procfs&quot;&gt;procfs&lt;/a&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ cat /proc/&amp;lt;pid&amp;gt;/cmdline&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>ssh rsa public key encryption</title>
        <published>2016-09-29T15:22:12+02:00</published>
        <updated>2016-09-29T15:22:12+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/ssh-rsa-public-key-encryption/"/>
        <id>https://nbari.com/ssh-rsa-public-key-encryption/</id>
        
        <content type="html" xml:base="https://nbari.com/ssh-rsa-public-key-encryption/">&lt;p&gt;Encrypt a file using ssh public keys.&lt;/p&gt;
&lt;p&gt;Create ssh public key in PEM format:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; ssh-keygen -f id_rsa.pub -e -m PKCS8 &amp;gt; id_rsa.pem.pub&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Use openssl to encrypt/decrypt&lt;/p&gt;
&lt;p&gt;Encrypt:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;openssl rsautl -encrypt -pubin -inkey ~/.ssh/id_rsa.pem.pub -ssl -in test.txt -out test.txt.enc&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Decrypt:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;openssl rsautl -decrypt -inkey ~/.ssh/id_rsa -in test.txt.enc -out test.txt.enc.txt&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>reset qnap virtual switch</title>
        <published>2016-09-28T22:53:22+02:00</published>
        <updated>2016-09-28T22:53:22+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/reset-qnap-virtual-switch/"/>
        <id>https://nbari.com/reset-qnap-virtual-switch/</id>
        
        <content type="html" xml:base="https://nbari.com/reset-qnap-virtual-switch/">&lt;p&gt;To reset the QNAP Virtualization Station, rename the file:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;/share/CE_CACHEDEV1_DATA/.qpkg/.QKVM&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;to&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;/share/CE_CACHEDEV1_DATA/.qpkg/.QKVM-backup&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;From the App center remove/install the Virtualization Station.&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>E437 terminal capability cm required</title>
        <published>2016-09-28T22:02:37+02:00</published>
        <updated>2016-09-28T22:02:37+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/e437-terminal-capability-cm-required/"/>
        <id>https://nbari.com/e437-terminal-capability-cm-required/</id>
        
        <content type="html" xml:base="https://nbari.com/e437-terminal-capability-cm-required/">&lt;p&gt;When trying to open vi/vim the following message could appear:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;quot;E437: terminal capability &amp;quot;cm&amp;quot; required&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To fix it type:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ export TERM=xterm&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>aws uptime</title>
        <published>2016-09-27T16:12:36+02:00</published>
        <updated>2016-09-27T16:12:36+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/aws-uptime/"/>
        <id>https://nbari.com/aws-uptime/</id>
        
        <content type="html" xml:base="https://nbari.com/aws-uptime/">&lt;h1 id=&quot;aws-657-days&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#aws-657-days&quot; aria-label=&quot;Anchor link for: aws-657-days&quot;&gt;🔗&lt;/a&gt;AWS &amp;gt;= 657 days&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;OS: FreeBSD 8.2&lt;/li&gt;
&lt;li&gt;AWS: us-east-1&lt;/li&gt;
&lt;li&gt;Type: t1.micro&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;/img/aws-uname.png&quot; alt=&quot;uname&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;img src=&quot;/img/aws-uptime.png&quot; alt=&quot;uptime&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;img src=&quot;/img/aws-vnstat.png&quot; alt=&quot;vnstat&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;img src=&quot;/img/aws-top.png&quot; alt=&quot;top&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>debian parted</title>
        <published>2016-09-26T15:38:33+02:00</published>
        <updated>2016-09-26T15:38:33+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/debian-parted/"/>
        <id>https://nbari.com/debian-parted/</id>
        
        <content type="html" xml:base="https://nbari.com/debian-parted/">&lt;h1 id=&quot;resize-aws-debian-jessie&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#resize-aws-debian-jessie&quot; aria-label=&quot;Anchor link for: resize-aws-debian-jessie&quot;&gt;🔗&lt;/a&gt;Resize AWS Debian Jessie&lt;/h1&gt;
&lt;p&gt;Probably instance will have 8GB, to extend the disk, for example to 40GB do this:&lt;/p&gt;
&lt;p&gt;Install parted:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ apt-get install parted&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Run:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ /sbin/parted ---pretend-input-tty /dev/xvda resizepart 1 yes 100%&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Resize2fs:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ resize2fs /dev/xvda1&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Run &lt;code&gt;lsblk&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;root@ip-10-20-1-17:~# lsblk&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;NAME    MAJ:MIN RM SIZE RO TYPE MOUNTPOINT&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;xvda    202:0    0  40G  0 disk&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;`-xvda1 202:1    0  40G  0 part /&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>CI &amp; CD</title>
        <published>2016-09-26T14:08:44+02:00</published>
        <updated>2016-09-26T14:08:44+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/ci-cd/"/>
        <id>https://nbari.com/ci-cd/</id>
        
        <content type="html" xml:base="https://nbari.com/ci-cd/">&lt;h1 id=&quot;release-pipeline-ci-cd&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#release-pipeline-ci-cd&quot; aria-label=&quot;Anchor link for: release-pipeline-ci-cd&quot;&gt;🔗&lt;/a&gt;Release pipeline CI &amp;amp; CD&lt;/h1&gt;
&lt;p&gt;&lt;img src=&quot;/img/ci-cd1.png&quot; alt=&quot;ci-cd1&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/img/ci-cd2.png&quot; alt=&quot;ci-cd2&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/img/ci-cd3.png&quot; alt=&quot;ci-cd3&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Raspberry Pi 1 Model B</title>
        <published>2016-09-24T15:25:11+02:00</published>
        <updated>2016-09-24T15:25:11+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/rpi/"/>
        <id>https://nbari.com/rpi/</id>
        
        <content type="html" xml:base="https://nbari.com/rpi/">&lt;h1 id=&quot;raspberry-pi-1-model-b-freebsd-wifi&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#raspberry-pi-1-model-b-freebsd-wifi&quot; aria-label=&quot;Anchor link for: raspberry-pi-1-model-b-freebsd-wifi&quot;&gt;🔗&lt;/a&gt;Raspberry Pi 1 Model B, FreeBSD + wifi&lt;/h1&gt;
&lt;p&gt;&lt;img src=&quot;/img/rpi-b.jpg&quot; alt=&quot;RPI-b&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;&lt;/p&gt;
&lt;p&gt;cat /var/run/dmesg.boot:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;KDB: debugger backends: ddb&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;KDB: current backend: ddb&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Copyright (c) 1992-2016 The FreeBSD Project.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	The Regents of the University of California. All rights reserved.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;FreeBSD is a registered trademark of The FreeBSD Foundation.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;FreeBSD 10.3-RELEASE #0 r297264: Fri Mar 25 08:01:14 UTC 2016&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    root@releng1.nyi.freebsd.org:/usr/obj/arm.armv6/usr/src/sys/RPI-B arm&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;FreeBSD clang version 3.4.1 (tags/RELEASE_34/dot1-final 208032) 20140512&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;VT: init without driver.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;CPU: ARM1176JZ-S rev 7 (ARM11J core)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; Supported features: ARM_ISA THUMB2 JAZELLE ARMv4 Security_Ext&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; WB enabled LABT branch prediction enabled&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  16KB/32B 4-way instruction cache&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  16KB/32B 4-way write-back-locking-C data cache&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;real memory  = 503312384 (479 MB)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;avail memory = 483127296 (460 MB)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;random: &amp;lt;Software, Yarrow&amp;gt; initialized&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;kbd0 at kbdmux0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ofwbus0: &amp;lt;Open Firmware Device Tree&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;simplebus0: &amp;lt;Flattened device tree simple bus&amp;gt; mem 0x20000000-0x20ffffff on ofwbus0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cpulist0: &amp;lt;Open Firmware CPU Group&amp;gt; on ofwbus0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cpu0: &amp;lt;Open Firmware CPU&amp;gt; on cpulist0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;bcm2835_cpufreq0: &amp;lt;CPU Frequency Control&amp;gt; on cpu0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;intc0: &amp;lt;BCM2835 Interrupt Controller&amp;gt; mem 0xb200-0xb3ff on simplebus0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;systimer0: &amp;lt;BCM2835 System Timer&amp;gt; mem 0x3000-0x3fff irq 8,9,10,11 on simplebus0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Event timer &amp;quot;BCM2835 Event Timer 3&amp;quot; frequency 1000000 Hz quality 1000&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Timecounter &amp;quot;BCM2835 Timecounter&amp;quot; frequency 1000000 Hz quality 1000&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;bcmwd0: &amp;lt;BCM2708/2835 Watchdog&amp;gt; mem 0x10001c-0x100027 on simplebus0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gpio0: &amp;lt;BCM2708/2835 GPIO controller&amp;gt; mem 0x200000-0x2000af irq 57,59,58,60 on simplebus0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gpio0: read-only pins: 46,47,48,49,50,51,52,53.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gpio0: reserved pins: 48,49,50,51,52,53.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gpioc0: &amp;lt;GPIO controller&amp;gt; on gpio0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gpiobus0: &amp;lt;OFW GPIO bus&amp;gt; on gpio0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gpioled0: &amp;lt;GPIO led&amp;gt; at pin(s) 16 on gpiobus0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;iichb0: &amp;lt;BCM2708/2835 BSC controller&amp;gt; mem 0x205000-0x20501f irq 61 on simplebus0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;iicbus0: &amp;lt;OFW I2C bus&amp;gt; on iichb0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;iic0: &amp;lt;I2C generic I/O&amp;gt; on iicbus0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;iichb1: &amp;lt;BCM2708/2835 BSC controller&amp;gt; mem 0x804000-0x80401f irq 61 on simplebus0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;iicbus1: &amp;lt;OFW I2C bus&amp;gt; on iichb1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;iic1: &amp;lt;I2C generic I/O&amp;gt; on iicbus1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;spi0: &amp;lt;BCM2708/2835 SPI controller&amp;gt; mem 0x204000-0x20401f irq 62 on simplebus0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;spibus0: &amp;lt;OFW SPI bus&amp;gt; on spi0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;bcm_dma0: &amp;lt;BCM2835 DMA Controller&amp;gt; mem 0x7000-0x7fff,0xe05000-0xe05fff irq 24,25,26,27,28,29,30,31,32,33,34,35,36 on simplebus0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mbox0: &amp;lt;BCM2835 VideoCore Mailbox&amp;gt; mem 0xb880-0xb8bf irq 1 on simplebus0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sdhci_bcm0: &amp;lt;Broadcom 2708 SDHCI controller&amp;gt; mem 0x300000-0x3000ff irq 70 on simplebus0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mmc0: &amp;lt;MMC/SD bus&amp;gt; on sdhci_bcm0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;uart0: &amp;lt;PrimeCell UART (PL011)&amp;gt; mem 0x201000-0x201fff irq 65 on simplebus0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;uart0: console (115200,n,8,1)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dwcotg0: &amp;lt;DWC OTG 2.0 integrated USB controller&amp;gt; mem 0x980000-0x99ffff irq 17 on simplebus0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;usbus0 on dwcotg0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;fb0: &amp;lt;BCM2835 VT framebuffer driver&amp;gt; on ofwbus0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Timecounters tick every 10.000 msec&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;usbus0: 480Mbps High Speed USB v2.0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;bcm2835_cpufreq0: ARM 700MHz, Core 250MHz, SDRAM 398MHz, Turbo OFF&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ugen0.1: &amp;lt;DWCOTG&amp;gt; at usbus0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;uhub0: &amp;lt;DWCOTG OTG Root HUB, class 9/0, rev 2.00/1.00, addr 1&amp;gt; on usbus0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mmcsd0: 4GB &amp;lt;SDHC SA04G 0.3 SN 9C4F1E62 MFG 05/2009 by 2 TM&amp;gt; at mmc0 41.6MHz/4bit/65535-block&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;fb0: 656x416(0x0@0,0) 16bpp&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;fb0: pitch 1312, base 0x5e006000, screen_size 545792&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;fbd0 on fb0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;VT: initialize with new VT driver &amp;quot;fb&amp;quot;.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;random: unblocking device.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Root mount waiting for: usbus0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;uhub0: 1 port with 1 removable, self powered&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ugen0.2: &amp;lt;vendor 0x0424&amp;gt; at usbus0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;uhub1: &amp;lt;vendor 0x0424 product 0x9512, class 9/0, rev 2.00/2.00, addr 2&amp;gt; on usbus0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;uhub1: MTT enabled&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Root mount waiting for: usbus0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;uhub1: 3 ports with 2 removable, self powered&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Root mount waiting for: usbus0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ugen0.3: &amp;lt;vendor 0x0424&amp;gt; at usbus0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;smsc0: &amp;lt;vendor 0x0424 product 0xec00, rev 2.00/2.00, addr 3&amp;gt; on usbus0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;smsc0: chip 0xec00, rev. 0002&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;miibus0: &amp;lt;MII bus&amp;gt; on smsc0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ukphy0: &amp;lt;Generic IEEE 802.3u media interface&amp;gt; PHY 1 on miibus0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ukphy0:  none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ue0: &amp;lt;USB Ethernet&amp;gt; on smsc0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ue0: Ethernet address: b8:27:ab:28:f0:f7&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ugen0.4: &amp;lt;vendor 0x0bda&amp;gt; at usbus0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Trying to mount root from ufs:/dev/ufs/rootfs [rw]...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;warning: no time-of-day clock registered, system time will not be set accurately&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;smsc0: chip 0xec00, rev. 0002&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ue0: link state changed to DOWN&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;urtwn0: &amp;lt;vendor 0x0bda product 0x8176, class 0/0, rev 2.00/2.00, addr 4&amp;gt; on usbus0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;urtwn0: MAC/BB RTL8188CUS, RF 6052 1T1R&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;wlan0: Ethernet address: e8:4a:05:35:47:12&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;wlan0: link state changed to UP&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;EDUP WiFi adapter mini USB dongle&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;urtwn0: &amp;lt;vendor 0x0bda product 0x8176, class 0/0, rev 2.00/2.00, addr 4&amp;gt; on usbus0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;urtwn0: MAC/BB RTL8188CUS, RF 6052 1T1R&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&quot;/img/edup802.11N.jpg&quot; alt=&quot;EDUP&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Download the FreeBSD SD card image from: https://www.freebsd.org/where.html&lt;/p&gt;
&lt;p&gt;Find your SD:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ diskutil list&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Unmount the disk in this case disk3:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ diskutil unmountDisk /dev/disk3&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Copy the img to the SD card:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ sudo dd bs=1m if=freebsd.img of=/dev/rdisk3&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;setup-the-wifi&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#setup-the-wifi&quot; aria-label=&quot;Anchor link for: setup-the-wifi&quot;&gt;🔗&lt;/a&gt;Setup the Wifi&lt;/h2&gt;
&lt;p&gt;Add to &lt;code&gt;/boot/loader.conf&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;legal.realtek.license_ack=1&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Edit rc.conf:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;wlans_urtwn0=&amp;quot;wlan0&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ifconfig_wlan0=&amp;quot;ssid your.sid WPA DHCP&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Edit &lt;code&gt;/etc/wpa_supplicant.conf&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;network={&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	ssid=&amp;quot;your.sid&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	scan_ssid=1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	proto=WPA RSN&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	pairwise=CCMP&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	psk=&amp;quot;*password*&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	priority=5&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Cron to ping every minute to the gateway:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;* * * * * /sbin/ping -c 3 192.168.1.1 &amp;gt; /tmp/ping.out&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;login&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#login&quot; aria-label=&quot;Anchor link for: login&quot;&gt;🔗&lt;/a&gt;login&lt;/h2&gt;
&lt;p&gt;Default user/password:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;root:root&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;freebsd:freebsd&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The &lt;code&gt;freebsd&lt;/code&gt; user can be used to ssh and latter &lt;code&gt;su&lt;/code&gt;&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>uptime 1000 days</title>
        <published>2016-09-21T21:59:28+02:00</published>
        <updated>2016-09-21T21:59:28+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/1000/"/>
        <id>https://nbari.com/1000/</id>
        
        <content type="html" xml:base="https://nbari.com/1000/">&lt;h1 id=&quot;uptime-1000-days&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#uptime-1000-days&quot; aria-label=&quot;Anchor link for: uptime-1000-days&quot;&gt;🔗&lt;/a&gt;uptime &amp;gt;= 1000 days&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;OS: FreeBSD + ZFS + Jails&lt;/li&gt;
&lt;li&gt;Server: Dell PowerEdge 2900 2xE5420 24GB RAM&lt;/li&gt;
&lt;li&gt;Colocation: https://iweb.com/&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;/img/uname-1000.png&quot; alt=&quot;uname&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;img src=&quot;/img/uptime-1000.png&quot; alt=&quot;uptime&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;img src=&quot;/img/vnstat-1000.png&quot; alt=&quot;vnstat&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;img src=&quot;/img/systat-vmstat.png&quot; alt=&quot;systat-vmstat&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;img src=&quot;/img/mfiutil-show-drives.png&quot; alt=&quot;mfiutil&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;img src=&quot;/img/top-1000.png&quot; alt=&quot;top&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;img src=&quot;/img/zpool-1000.png&quot; alt=&quot;zpool&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;img src=&quot;/img/dmesg-1000.png&quot; alt=&quot;dmesg&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;img src=&quot;/img/fans-1000.png&quot; alt=&quot;fans&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;img src=&quot;/img/power-supplies-1000.png&quot; alt=&quot;power-supplies&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;img src=&quot;/img/temperatures-1000.png&quot; alt=&quot;temperatures&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;img src=&quot;/img/voltages-1000.png&quot; alt=&quot;voltages&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;img src=&quot;/img/boot-post5.png&quot; alt=&quot;post-boot&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;img src=&quot;/img/post0-socrates.png&quot; alt=&quot;post-socrates&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Time to reboot after 4 years:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/img/4-years.png&quot; alt=&quot;4 years&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;&lt;/p&gt;
&lt;p&gt;I need to rebuild the RAID and can&#39;t mix SAS drives with SATA on an living array:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/img/SAS-SATA.png&quot; alt=&quot;SAS-SATA&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>aws ec2 associate address</title>
        <published>2016-08-30T12:27:56+02:00</published>
        <updated>2016-08-30T12:27:56+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/aws-ec2-associate-address/"/>
        <id>https://nbari.com/aws-ec2-associate-address/</id>
        
        <content type="html" xml:base="https://nbari.com/aws-ec2-associate-address/">&lt;p&gt;If doing more than 100 requests implying the AWS CLI &lt;code&gt;associate-address&lt;/code&gt;
sub-command, subsequent calls will cost &lt;strong&gt;$0.10&lt;/strong&gt; each, so If doing to much
scale in/out or have a monitoring/automated tool that frecuenly make API calls using
this sub-command, the bill is not going to be cheap:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Scale in  (remove instances)&lt;/li&gt;
&lt;li&gt;Scale out (add instances)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;/img/aws-ec2-associate-address.png&quot; alt=&quot;additional remap&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Long story short, The &lt;code&gt;associate-address&lt;/code&gt; sub-command, is an idempotent
operation, if you call &quot;aws ec2 associate-address&quot; with the same combination
of instance and EIP as the one currently in place, it won&#39;t return an error;
instead, it will return and count as successful, regardless of whether an actual
allocation was done or not. Consequently, being it counted as a successful
request, you&#39;ll be billed accordingly.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Idempotent operations take an important role, basically because you expect
that operation will not result in different results no matter how many times you
operate the idempotent operations. (Idempotent = Re-runnable).&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;This can be avoided by using private addresses and Load balancers, but in cases where
you need to deal with &lt;a rel=&quot;external&quot; href=&quot;http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/elastic-ip-addresses-eip.html&quot;&gt;Elastic IP&#39;s&lt;/a&gt; this maybe an issue, mainly for monitoring scripts or periodic checks, or use the &lt;a rel=&quot;external&quot; href=&quot;http://docs.aws.amazon.com/cli/latest/reference/ec2/describe-addresses.html&quot;&gt;describe-address&lt;/a&gt; and based on the result decide to use or not the &lt;code&gt;associate=address&lt;/code&gt; sub-command&lt;/p&gt;
&lt;h1 id=&quot;associate-address&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#associate-address&quot; aria-label=&quot;Anchor link for: associate-address&quot;&gt;🔗&lt;/a&gt;associate-address&lt;/h1&gt;
&lt;p&gt;Associates an Elastic IP address with an instance or a network interface. This
is an idempotent operation. If you perform the operation more than once, Amazon
EC2 doesn&#39;t return an error, example:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ aws ec2 associate-address --instance-id i-24ea6379 --allocation-id eipalloc-b58d24da&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;AssociationId&amp;quot;: &amp;quot;eipassoc-b7b117df&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;http://docs.aws.amazon.com/cli/latest/reference/ec2/associate-address.html&lt;/p&gt;
&lt;p&gt;After running the previous command 100 times, the following requests will cost
each &lt;code&gt;$0.10 per Elastic IP address remap&lt;/code&gt; either the association didn&#39;t
succeed or if it was made to an existing IP.&lt;/p&gt;
&lt;p&gt;Basically this means that if you have something that periodically checks your
instances and tries to remap or ensure that your elastic IP is pointing you a
desired instance:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    10.0.1.3 ---&amp;gt; 58.41.28.32&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;After doing 100 calls, the following request will cost &lt;strong&gt;$0.10&lt;/strong&gt; each.&lt;/p&gt;
&lt;h2 id=&quot;auto-scaling&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#auto-scaling&quot; aria-label=&quot;Anchor link for: auto-scaling&quot;&gt;🔗&lt;/a&gt;Auto scaling&lt;/h2&gt;
&lt;p&gt;While creating an auto-scaling group, could be the need to map each of the
instances to use an Elastic IP&#39;s, based on the scaling in/out policies
this would imply that after reaching the 100 limit, each reboot will cost
&lt;strong&gt;$0.10&lt;/strong&gt;.&lt;/p&gt;
&lt;h1 id=&quot;example-of-how-to-use-the-associate-address-from-a-startup-script&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#example-of-how-to-use-the-associate-address-from-a-startup-script&quot; aria-label=&quot;Anchor link for: example-of-how-to-use-the-associate-address-from-a-startup-script&quot;&gt;🔗&lt;/a&gt;Example of how to use the &lt;code&gt;associate-address&lt;/code&gt; from a startup script&lt;/h1&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;#!/bin/sh&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;# KEYWORD: firstboot&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;# PROVIDE: set_hostname&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;# REQUIRE: NETWORKING&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;# BEFORE:  SERVERS&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; /etc/rc.subr&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;name&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;set_hostname&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;rcvar&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;set_hostname_enable&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;start_cmd&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;set_hostname_run&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;stop_cmd&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-8&quot;&gt;export&lt;/span&gt;&lt;span&gt; AWS_ACCESS_KEY_ID&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&lt;/span&gt;&lt;span&gt;aws_access_key_id&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-8&quot;&gt;export&lt;/span&gt;&lt;span&gt; AWS_SECRET_ACCESS_KEY&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&lt;/span&gt;&lt;span&gt;aws_secret_access_key&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-8&quot;&gt;export&lt;/span&gt;&lt;span&gt; AWS_DEFAULT_REGION&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&lt;/span&gt;&lt;span&gt;the_region&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;TAG_NAME&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;Salt&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;INSTANCE_ID&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=$(&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;/usr/local/bin/curl&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -s http://169.254.169.254/latest/meta-data/instance-id&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;REGION&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=$(&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;/usr/local/bin/curl&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -s http://169.254.169.254/latest/meta-data/placement/availability-zone&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; |&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt; sed&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;#39;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;s/.$//&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;#39;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;TAG_VALUE&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=$(&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;/usr/local/bin/aws&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; ec2 describe-tags --filters&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;Name=resource-id,Values=&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;${&lt;/span&gt;&lt;span&gt;INSTANCE_ID&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;}&amp;quot; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;Name=key,Values=&lt;/span&gt;&lt;span&gt;$TAG_NAME&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; --region&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; ${&lt;/span&gt;&lt;span&gt;REGION&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; --output=text&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; |&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt; cut&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -f5&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;set_hostname_run&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;()&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;	hostname&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; ${&lt;/span&gt;&lt;span&gt;INSTANCE_ID&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;	sysrc&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; hostname=&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;${&lt;/span&gt;&lt;span&gt;INSTANCE_ID&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;	sysrc&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; salt_minion_enable=&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;YES&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;	echo&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; ${&lt;/span&gt;&lt;span&gt;INSTANCE_ID&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;} &amp;gt;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; /usr/local/etc/salt/minion_id&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;	pw&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; usermod root -c&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;root on &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;${&lt;/span&gt;&lt;span&gt;INSTANCE_ID&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;	if&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; [ ! -z &amp;quot;${&lt;/span&gt;&lt;span&gt;TAG_VALUE&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;}&amp;quot; ];&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt; then&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;		echo&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;node_type: &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;${&lt;/span&gt;&lt;span&gt;TAG_VALUE&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;}&amp;quot; &amp;gt;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; /usr/local/etc/salt/grains&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;	fi&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;	# allocate IP X.X.X.X&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;	/usr/local/bin/aws&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; ec2 associate-address --instance-id&lt;/span&gt;&lt;span&gt; $INSTANCE_ID&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; --allocation-id eipalloc-xxxxxxxx&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;load_rc_config&lt;/span&gt;&lt;span&gt; $name&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;run_rc_command&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot; z-i&quot;&gt;$1&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>letsencrypt + cloudfare using DNS</title>
        <published>2016-08-22T12:25:18+02:00</published>
        <updated>2016-08-22T12:25:18+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/letsencrypt-cloudfare/"/>
        <id>https://nbari.com/letsencrypt-cloudfare/</id>
        
        <content type="html" xml:base="https://nbari.com/letsencrypt-cloudfare/">&lt;p&gt;It&#39;s not necessary to disable CloudFlare to use Let&#39;s Encrypt,&lt;/p&gt;
&lt;h1 id=&quot;installation&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#installation&quot; aria-label=&quot;Anchor link for: installation&quot;&gt;🔗&lt;/a&gt;Installation:&lt;/h1&gt;
&lt;p&gt;On mac os X:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ git clone https://github.com/lukas2511/letsencrypt.sh&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ cd letsencrypt.sh&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ mkdir hooks&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ git clone https://github.com/kappataumu/letsencrypt-cloudflare-hook hooks/cloudflare&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ pip install -r hooks/cloudflare/requirements-python-2.txt&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h1 id=&quot;configuration&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#configuration&quot; aria-label=&quot;Anchor link for: configuration&quot;&gt;🔗&lt;/a&gt;Configuration&lt;/h1&gt;
&lt;p&gt;Your account&#39;s CloudFlare email and API key are expected to be in the environment:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ export CF_EMAIL=&amp;quot;your@email&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ export CF_KEY=&amp;quot;Global API Key&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ export CF_DNS_SERVERS=&amp;#39;8.8.8.8 8.8.4.4&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h1 id=&quot;usage&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#usage&quot; aria-label=&quot;Anchor link for: usage&quot;&gt;🔗&lt;/a&gt;Usage&lt;/h1&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ ./letsencrypt.sh -c -d imap.ejemplo.org -t dns-01 -k &amp;quot;hooks/cloudflare/hook.py&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;#&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# !! WARNING !! No main config file found, using default config!&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;#&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Processing imap.ejemplo.org&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; + Signing domains...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; + Generating private key...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; + Generating signing request...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; + Requesting challenge for imap.ejemplo.org...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; + CloudFlare hook executing: deploy_challenge&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; + Settling down for 10s...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; + DNS not propagated, waiting 30s...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; + Responding to challenge for imap.ejemplo.org...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; + CloudFlare hook executing: clean_challenge&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; + Challenge is valid!&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; + Requesting certificate...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; + Checking certificate...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; + Done!&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; + Creating fullchain.pem...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; + CloudFlare hook executing: deploy_cert&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; + ssl_certificate: /Users/user/projects/letsencrypt.sh/certs/imap.ejemplo.org/fullchain.pem&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; + ssl_certificate_key: /Users/user/projects/letsencrypt.sh/certs/imap.ejemplo.org/privkey.pem&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; + Done!&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h1 id=&quot;automated-certificate-renewal&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#automated-certificate-renewal&quot; aria-label=&quot;Anchor link for: automated-certificate-renewal&quot;&gt;🔗&lt;/a&gt;Automated certificate renewal&lt;/h1&gt;
&lt;p&gt;Put all your domain names in letsencrypt.sh/domains.txt, example:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ejemplo.org www.ejemplo.org imap.ejemplo.org&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Create a &lt;code&gt;cron.sh&lt;/code&gt; script:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    #!/bin/sh&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    export CF_EMAIL=&amp;quot;your@email&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    export CF_KEY=&amp;quot;Global API Key&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    export CF_DNS_SERVERS=&amp;#39;8.8.8.8 8.8.4.4&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    /path/to//letsencrypt.sh --cron --challenge dns-01 \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        --hook &amp;#39;/path/to/letsencrypt.sh/hooks/cloudfare/hook.py&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    service dovecot restart&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Add the cron:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0 4 * * * /path/to/cron.sh &amp;gt;&amp;gt; /path/to/cron.log 2&amp;gt;&amp;amp;1&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>error loading certificates pkg freebsd</title>
        <published>2016-08-20T12:44:47+02:00</published>
        <updated>2016-08-20T12:44:47+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/error-loading-certificates-pkg-freebsd/"/>
        <id>https://nbari.com/error-loading-certificates-pkg-freebsd/</id>
        
        <content type="html" xml:base="https://nbari.com/error-loading-certificates-pkg-freebsd/">&lt;p&gt;On an FreeBSD 9 while trying to install python or something else via pkg you may get this:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;gt; pkg search python&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pkg: Repository FreeBSD missing. &amp;#39;pkg update&amp;#39; required&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pkg: Error loading trusted certificates&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pkg: Error loading trusted certificates&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pkg: Repository FreeBSD cannot be opened. &amp;#39;pkg update&amp;#39; required&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To solve it, fetch the current official repository key:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mkdir -p /usr/share/keys/pkg/trusted /usr/share/keys/pkg/revoked&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;svn export https://svn0.us-west.FreeBSD.org/base/head/share/keys/pkg/trusted/pkg.freebsd.org.2013102301 /usr/share/keys/pkg/trusted/&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then set the repo:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;FreeBSD: {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  url: &amp;quot;pkg+http://pkg.FreeBSD.org/${ABI}/latest&amp;quot;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  mirror_type: &amp;quot;srv&amp;quot;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  signature_type: &amp;quot;fingerprints&amp;quot;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  fingerprints: &amp;quot;/usr/share/keys/pkg&amp;quot;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  enabled: yes&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Next, running &lt;code&gt;pkg udpate&lt;/code&gt; should work:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ pkg update&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Updating FreeBSD repository catalogue...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[ca2.route.mx] Fetching meta.txz: 100%    968 B   1.0kB/s    00:01&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[ca2.route.mx] Fetching packagesite.txz: 100%    5 MiB   5.7MB/s    00:01&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Processing entries: 100%&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;FreeBSD repository update completed. 25174 packages processed.&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>/bin/sh shell set</title>
        <published>2016-08-11T11:28:20+02:00</published>
        <updated>2016-08-11T11:28:20+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/shell-set/"/>
        <id>https://nbari.com/shell-set/</id>
        
        <content type="html" xml:base="https://nbari.com/shell-set/">&lt;p&gt;The Bourne shell (sh) is a shell, or command-line interpreter, for computer operating systems.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The Bourne shell was the default shell for Unix Version 7. Most Unix-like
systems continue to have /bin/sh—which will be the Bourne shell, or a symbolic
link or hard link to a compatible shell even when other shells are used by most
users. https://en.wikipedia.org/wiki/Bourne_shell&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h1 id=&quot;set-options&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#set-options&quot; aria-label=&quot;Anchor link for: set-options&quot;&gt;🔗&lt;/a&gt;set options&lt;/h1&gt;
&lt;p&gt;In &lt;strong&gt;sh&lt;/strong&gt;, the set built-in command has the following options:&lt;/p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;option&lt;/th&gt;&lt;th&gt;Description&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;--&lt;/td&gt;&lt;td&gt;An option of a double-dash (&quot;--&quot;) signifies the end of an option list. This is primarily useful when values listed after the options will start with a dash themselves.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;-a&lt;/td&gt;&lt;td&gt;Mark variables which are modified or created for &quot;export&quot;; environment variables set in this way will be passed on to the environments of any subsequent commands.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;-e&lt;/td&gt;&lt;td&gt;Exit immediately if a command exits with a non-zero exit status.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;-f&lt;/td&gt;&lt;td&gt;Disable file name generation (globbing).&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;-h&lt;/td&gt;&lt;td&gt;Locate and remember function commands as functions are defined (function commands are normally located when the function is executed).&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;-n&lt;/td&gt;&lt;td&gt;Read commands but do not execute them.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;-t&lt;/td&gt;&lt;td&gt;Exit after reading and executing one command.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;-u&lt;/td&gt;&lt;td&gt;Treat unset variables as an error when substituting.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;-v&lt;/td&gt;&lt;td&gt;Print shell input lines as they are read.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;-x&lt;/td&gt;&lt;td&gt;Print commands and their arguments as they are executed.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;p&gt;Using &lt;code&gt;+&lt;/code&gt; rather than &lt;code&gt;-&lt;/code&gt; causes these flags to be turned off.&lt;/p&gt;
&lt;p&gt;Example:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;#!/bin/sh&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;set&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -e&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;set&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -x&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;test&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 1&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -eq&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;echo&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;never printed&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>mosh</title>
        <published>2016-08-10T22:25:25+02:00</published>
        <updated>2016-08-10T22:25:25+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/mosh/"/>
        <id>https://nbari.com/mosh/</id>
        
        <content type="html" xml:base="https://nbari.com/mosh/">&lt;h1 id=&quot;mosh-mobile-shell&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#mosh-mobile-shell&quot; aria-label=&quot;Anchor link for: mosh-mobile-shell&quot;&gt;🔗&lt;/a&gt;mosh (mobile shell)&lt;/h1&gt;
&lt;blockquote&gt;
&lt;p&gt;Remote terminal application that allows roaming, supports intermittent
connectivity, and provides intelligent local echo and line editing of user
keystrokes. Mosh is a replacement for SSH. It&#39;s more robust and responsive,
especially over Wi-Fi, cellular, and long-distance links.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id=&quot;how-to-install&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#how-to-install&quot; aria-label=&quot;Anchor link for: how-to-install&quot;&gt;🔗&lt;/a&gt;How to install&lt;/h2&gt;
&lt;h3 id=&quot;server&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#server&quot; aria-label=&quot;Anchor link for: server&quot;&gt;🔗&lt;/a&gt;server&lt;/h3&gt;
&lt;p&gt;FreeBSD:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ pkg install net/mosh&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Edit &lt;code&gt;/etc/login.conf&lt;/code&gt; and add this to the default:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    :charset=UTF-8:\&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    :lang=en_US.UTF-8:\&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    :setenv=LC_COLLATE=C:&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;After editing &lt;code&gt;/etc/locing.conf&lt;/code&gt; run:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ cap_mkdb /etc/login.conf&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&quot;client&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#client&quot; aria-label=&quot;Anchor link for: client&quot;&gt;🔗&lt;/a&gt;Client&lt;/h3&gt;
&lt;p&gt;In a mac OS X;&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ brew install mosh&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;how-to-use&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#how-to-use&quot; aria-label=&quot;Anchor link for: how-to-use&quot;&gt;🔗&lt;/a&gt;How to use&lt;/h2&gt;
&lt;p&gt;Basically just type &lt;code&gt;mosh&lt;/code&gt; instead of &lt;code&gt;ssh&lt;/code&gt;, Mosh will log the user in via
SSH, then start a connection on a UDP port between 60000 and 61000., Mosh will
log the user in via SSH, then start a connection on a UDP port between 60000 and
61000.&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ mosh your.server.tld&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;or&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ mosh user@your.server.tld&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Selecting SSH port:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ mosh --ssh=&amp;quot;ssh -p 2222&amp;quot; your.server.tld&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;or&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ mosh user@your.server.tld --ssh=&amp;quot;ssh -p 2222&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Specify ssh key:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ mosh --ssh=&amp;quot;ssh -i ./identity&amp;quot; your.server.tld&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;or&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ mosh --ssh=&amp;quot;ssh -i ~/.ssh/id_rsa_devops -p 2222&amp;quot; 192.168.1.4&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;With tmux:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ mosh host --ssh=&amp;quot;ssh -p 3333&amp;quot; -- sh -c &amp;quot;tmux -2 attach -t $USER -d || tmux -2 new -s $USER&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;More info: https://mosh.mit.edu/&lt;/p&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;http://www.youtube.com/watch?v=XsIxNYl0oyU&quot;&gt;&lt;img src=&quot;http://img.youtube.com/vi/XsIxNYl0oyU/0.jpg&quot; alt=&quot;mosh&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Why is unit testing important?</title>
        <published>2016-08-08T23:50:29+02:00</published>
        <updated>2016-08-08T23:50:29+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/unit-testing-important/"/>
        <id>https://nbari.com/unit-testing-important/</id>
        
        <content type="html" xml:base="https://nbari.com/unit-testing-important/">&lt;h1 id=&quot;why-is-unit-testing-important&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#why-is-unit-testing-important&quot; aria-label=&quot;Anchor link for: why-is-unit-testing-important&quot;&gt;🔗&lt;/a&gt;Why is unit testing important?&lt;/h1&gt;
&lt;p&gt;Short answer, to avoid something like this:&lt;/p&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://n26.com&quot;&gt;&lt;img src=&quot;/img/n26.png&quot; alt=&quot;n26&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The links are inverted&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Because of that error, people may not be available to download or install the proper app and therefore will lost credibility of the service.&lt;/p&gt;
&lt;h1 id=&quot;what-is-unit-testing&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#what-is-unit-testing&quot; aria-label=&quot;Anchor link for: what-is-unit-testing&quot;&gt;🔗&lt;/a&gt;What is Unit Testing?&lt;/h1&gt;
&lt;p&gt;In computer programming, unit testing is a software testing method by which
individual units of source code, sets of one or more computer program
modules together with associated control data, usage procedures, and
operating procedures, are tested to determine whether they are fit for use.
(https://en.wikipedia.org/wiki/Unit_testing)&lt;/p&gt;
&lt;h1 id=&quot;the-bottom-line&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#the-bottom-line&quot; aria-label=&quot;Anchor link for: the-bottom-line&quot;&gt;🔗&lt;/a&gt;The bottom line&lt;/h1&gt;
&lt;p&gt;If unit testing is written and performed properly and consistently, software
projects are a lot more effective at delivering the correct solution in a
predictable and managed way.&lt;/p&gt;
&lt;p&gt;http://bfy.tw/77kx&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>vim</title>
        <published>2016-08-08T11:27:26+02:00</published>
        <updated>2016-08-08T11:27:26+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/vim/"/>
        <id>https://nbari.com/vim/</id>
        
        <content type="html" xml:base="https://nbari.com/vim/">&lt;h2 id=&quot;quote-unquote-words&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#quote-unquote-words&quot; aria-label=&quot;Anchor link for: quote-unquote-words&quot;&gt;🔗&lt;/a&gt;Quote/unquote words:&lt;/h2&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ciw&amp;#39;Ctrl+r&amp;quot;&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;or&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ciw &amp;#39;&amp;#39; Esc p&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;p&lt;/code&gt; paste after the cursor, &lt;code&gt;P&lt;/code&gt; will paste before the cursor.&lt;/p&gt;
&lt;h2 id=&quot;search-matches-gn-with-the-dot-command&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#search-matches-gn-with-the-dot-command&quot; aria-label=&quot;Anchor link for: search-matches-gn-with-the-dot-command&quot;&gt;🔗&lt;/a&gt;Search matches (gn with the dot command)&lt;/h2&gt;
&lt;p&gt;Suppose that we have a document containing several occurrences of the word
‘Normal’ and we’d like to change each occurrence to ‘Visual’. We can run &lt;code&gt;/Normal&lt;/code&gt;
to search for the word ‘Normal’, then type &lt;code&gt;cgnVisual&amp;lt;Esc&amp;gt;&lt;/code&gt; to change the next
match to the word ‘Visual’ and by pressing &lt;code&gt;.&lt;/code&gt; it will change the next match.
No need to use &lt;code&gt;n.&lt;/code&gt; (http://vimcasts.org/episodes/operating-on-search-matches-using-gn/)&lt;/p&gt;
&lt;h2 id=&quot;habit-breaking&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#habit-breaking&quot; aria-label=&quot;Anchor link for: habit-breaking&quot;&gt;🔗&lt;/a&gt;Habit breaking&lt;/h2&gt;
&lt;p&gt;Moving your Vim cursor around using the arrow keys is a bad habit, and like many
bad habits it’s a difficult one to break! Putting these lines into your vimrc can
help:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;nnoremap &amp;lt;up&amp;gt;    &amp;lt;nop&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;nnoremap &amp;lt;down&amp;gt;  &amp;lt;nop&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;nnoremap &amp;lt;left&amp;gt;  &amp;lt;nop&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;nnoremap &amp;lt;right&amp;gt; &amp;lt;nop&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;inoremap &amp;lt;up&amp;gt;    &amp;lt;nop&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;inoremap &amp;lt;down&amp;gt;  &amp;lt;nop&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;inoremap &amp;lt;left&amp;gt;  &amp;lt;nop&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;inoremap &amp;lt;right&amp;gt; &amp;lt;nop&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This snippet causes each of the arrow keys to execute no operation, or in other
words: it disables them.&lt;/p&gt;
&lt;h2 id=&quot;traversing-test-in-insert-mode&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#traversing-test-in-insert-mode&quot; aria-label=&quot;Anchor link for: traversing-test-in-insert-mode&quot;&gt;🔗&lt;/a&gt;Traversing test in insert mode&lt;/h2&gt;
&lt;p&gt;While in insert mode, use &lt;code&gt;Ctrl-O&lt;/code&gt; to go to normal mode for just one command&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;CTRL-o h  move cursor left&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;CTRL-o l  move cursor right&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;CTRL-o j  move cursor down&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;CTRL-o k  move cursor up&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;CTRL-w    delete word to the left of cursor&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;CTRL-o D  delete everything to the right of cursor&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;CTRL-u    delete everything to the left of cursor&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;CTRL-h    backspace/delete&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;CTRL-j    insert newline (easier than reaching for the return key)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;CTRL-t    indent current line&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;CTRL-d    un-indent current line&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;vim-tmux-layout&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#vim-tmux-layout&quot; aria-label=&quot;Anchor link for: vim-tmux-layout&quot;&gt;🔗&lt;/a&gt;vim + tmux layout&lt;/h2&gt;
&lt;p&gt;Screen shot while playing with immortal&lt;/p&gt;
&lt;p&gt;![vim screen shot](/img/Screen Shot 2016-08-21 at 02.18.15.png)&lt;/p&gt;
&lt;p&gt;No Axis&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/img/vim-clean-no-axis.png&quot; alt=&quot;vim screen shot clean&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>brew macos</title>
        <published>2016-07-30T16:35:57+02:00</published>
        <updated>2016-07-30T16:35:57+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/brew/"/>
        <id>https://nbari.com/brew/</id>
        
        <content type="html" xml:base="https://nbari.com/brew/">&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;http://brew.sh&quot;&gt;Homebrew&lt;/a&gt; installs the stuff you need that Apple didn’t.&lt;/p&gt;
&lt;p&gt;For example to update python and avoid many SSL warnings:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;brew install python&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To use an updated version of git on mac use:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;brew install git --whitout-completion&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To update vim:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;brew install vim --with-override-system-vi&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Updating zsh:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# check the zsh info&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;brew info zsh&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# install zsh&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;brew install zsh&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# add shell path&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sudo vim /etc/shells&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# add the following line into the very end of the file(/etc/shells)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;/usr/local/bin/zsh&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# change default shell&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;chsh -s /usr/local/bin/zsh&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Install some extra packages in oneline:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;brew install tree colordiff ack autossh ipcalc iperf par pstree git-flow-avh&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To list all installed packges:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;brew list&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>asciinema</title>
        <published>2016-07-20T15:14:28+02:00</published>
        <updated>2016-07-20T15:14:28+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/asciinema/"/>
        <id>https://nbari.com/asciinema/</id>
        
        <content type="html" xml:base="https://nbari.com/asciinema/">&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://asciinema.org/&quot;&gt;asciinema&lt;/a&gt; [as-kee-nuh-muh] is a free and open source solution for recording
terminal sessions and sharing them on the web.&lt;/p&gt;
&lt;h2 id=&quot;install&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#install&quot; aria-label=&quot;Anchor link for: install&quot;&gt;🔗&lt;/a&gt;Install&lt;/h2&gt;
&lt;p&gt;FreeBSD:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pkg install asciiname&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;OS X:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;brew update &amp;amp;&amp;amp; brew install asciinema&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;recording-tmux-session&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#recording-tmux-session&quot; aria-label=&quot;Anchor link for: recording-tmux-session&quot;&gt;🔗&lt;/a&gt;Recording tmux session&lt;/h2&gt;
&lt;p&gt;Setup your tmux session create windows, splits, start processes in them:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;tmux new -s name&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Detach (prefix+d) and start recording with:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;asciinema rec -c &amp;quot;tmux attach -t name&amp;quot; /tmp/play.json&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;When you&#39;re finished, just detach the session again and play it with:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;asciinema play /tmp/play.json&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;upload&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#upload&quot; aria-label=&quot;Anchor link for: upload&quot;&gt;🔗&lt;/a&gt;upload&lt;/h2&gt;
&lt;p&gt;To upload the video&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; asciinema upload /tmp/play.json&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To claim ownership:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; asciinema auth&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Example file &lt;a href=&quot;/json/unicorn.json&quot;&gt;unicorn.json&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Video: &lt;a rel=&quot;external&quot; href=&quot;https://asciinema.org/a/85f9a4xefp83wzcw2bmiby2rn&quot;&gt;&lt;img src=&quot;https://asciinema.org/a/85f9a4xefp83wzcw2bmiby2rn.png&quot; alt=&quot;asciicast&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Example file &lt;a href=&quot;/json/immortal.json&quot;&gt;immortal.json&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Video: &lt;a rel=&quot;external&quot; href=&quot;https://asciinema.org/a/eii21k6u0h8oat56a1mrfwgti&quot;&gt;&lt;img src=&quot;https://asciinema.org/a/eii21k6u0h8oat56a1mrfwgti.png&quot; alt=&quot;asciicast&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Example file &lt;a href=&quot;/json/runit.json&quot;&gt;runit.json&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Video: &lt;a rel=&quot;external&quot; href=&quot;https://asciinema.org/a/8avsk45wk62r9ruorsl49nnjj&quot;&gt;&lt;img src=&quot;https://asciinema.org/a/8avsk45wk62r9ruorsl49nnjj.png&quot; alt=&quot;asciicast&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Example file &lt;a href=&quot;/json/immortal-logger.json&quot;&gt;immortal-logger.json&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Video: &lt;a rel=&quot;external&quot; href=&quot;https://asciinema.org/a/80376&quot;&gt;&lt;img src=&quot;https://asciinema.org/a/80376.png&quot; alt=&quot;asciicast&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>virtualbox-el-capitan</title>
        <published>2016-07-12T14:18:43+02:00</published>
        <updated>2016-07-12T14:18:43+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/virtualbox-el-capitan/"/>
        <id>https://nbari.com/virtualbox-el-capitan/</id>
        
        <content type="html" xml:base="https://nbari.com/virtualbox-el-capitan/">&lt;p&gt;When trying to install &lt;a rel=&quot;external&quot; href=&quot;https://www.virtualbox.org/&quot;&gt;Virtualbox&lt;/a&gt; in OS X El capitan you may notice it hangs at Verifying &quot;VirtualBox.pkg&quot;.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/img/verifying-virtualbox.png&quot; alt=&quot;verify&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;&lt;/p&gt;
&lt;p&gt;You can by pass the warning trying to install via command line with:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ sudo installer -package /Volumes/VirtualBox/VirtualBox.pkg -target /&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Simulate cron environment</title>
        <published>2016-07-11T14:23:00+02:00</published>
        <updated>2016-07-11T14:23:00+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/cron/"/>
        <id>https://nbari.com/cron/</id>
        
        <content type="html" xml:base="https://nbari.com/cron/">&lt;p&gt;Add this to your cron:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;* * * * * env &amp;gt; ~/cronenv&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then start a new shell using does environments:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;env - `cat ~/cronenv` /bin/sh&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>L2TP over IPSec</title>
        <published>2016-06-26T14:21:08+02:00</published>
        <updated>2016-06-26T14:21:08+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/l2tp-ipsec/"/>
        <id>https://nbari.com/l2tp-ipsec/</id>
        
        <content type="html" xml:base="https://nbari.com/l2tp-ipsec/">&lt;h1 id=&quot;l2tp&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#l2tp&quot; aria-label=&quot;Anchor link for: l2tp&quot;&gt;🔗&lt;/a&gt;L2TP&lt;/h1&gt;
&lt;p&gt;Layer 2 Tunneling Protocol (L2TP) is a tunneling protocol used to support
virtual private networks (VPNs) or as part of the delivery of services by ISPs.
It does not provide any encryption or confidentiality by itself. Rather, it
relies on an encryption protocol that it passes within the tunnel to provide
privacy.&lt;/p&gt;
&lt;h1 id=&quot;l2tp-ipsec&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#l2tp-ipsec&quot; aria-label=&quot;Anchor link for: l2tp-ipsec&quot;&gt;🔗&lt;/a&gt;L2TP/IPSec&lt;/h1&gt;
&lt;p&gt;Because of the lack of confidentiality inherent in the L2TP protocol, it is
often implemented along with IPsec. This is referred to as L2TP/IPsec, and is
standardized in IETF RFC 3193.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;https://en.wikipedia.org/wiki/Layer_2_Tunneling_Protocol&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h1 id=&quot;setting-up-an-l2tp-ipsec-freebsd-server&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#setting-up-an-l2tp-ipsec-freebsd-server&quot; aria-label=&quot;Anchor link for: setting-up-an-l2tp-ipsec-freebsd-server&quot;&gt;🔗&lt;/a&gt;Setting up an L2TP/IPSec FreeBSD server&lt;/h1&gt;
&lt;p&gt;Requirements:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;http://mpd.sourceforge.net/&quot;&gt;mpd5&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https://www.strongswan.org/&quot;&gt;strongswan&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https://www.freshports.org/net-mgmt/ng_ipacct/&quot;&gt;ng_ipacct&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https://www.freebsd.org/doc/handbook/firewalls-pf.html&quot;&gt;pf&lt;/a&gt; (for doing NAT)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Install mpd5:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ pkg install mpd5&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Install strongswan:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ pkg install strongswan&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;setting-up-mpd&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#setting-up-mpd&quot; aria-label=&quot;Anchor link for: setting-up-mpd&quot;&gt;🔗&lt;/a&gt;Setting up mpd&lt;/h2&gt;
&lt;p&gt;Example of an &lt;code&gt;mpd.conf&lt;/code&gt;, clients obtain an IP on the &lt;code&gt;172.16.13.0/24&lt;/code&gt;
segment.&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;startup:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;        # set user operations secret_changeme admin&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;default:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;    load&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; l2tp_server&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;l2tp_server:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;# Define dynamic IP address pool.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;    set&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; ippool add pool1&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 172.16.13.2 172.16.13.254&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;# Create clonable bundle template named B&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;    create&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; bundle template VPN&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;    set&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; iface enable netflow-in&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;    set&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; iface enable netflow-out&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;    set&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; iface enable ipacct&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;    set&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; iface enable proxy-arp&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;    set&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; iface enable tcpmssfix&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;    set&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; ipcp yes vjcomp&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;# Specify IP address pool for dynamic assigment.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;    set&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; ipcp ranges 172.16.13.1/32 ippool pool1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;    set&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; ipcp dns&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 8.8.8.8&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;# The five lines below enable Microsoft Point-to-Point encryption&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;# (MPPE) using the ng_mppc(8) netgraph node type.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;    set&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; bundle enable compression&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;    set&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; ccp yes mppc&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;    set&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; mppc yes e40&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;    set&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; mppc yes e128&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;    set&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; mppc yes stateless&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;# Create clonable link template named L&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;    create&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; link template L l2tp&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;# Set bundle template to use&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;    set&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; link action bundle VPN&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;    set&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; link enable multilink&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;    set&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; link yes acfcomp protocomp&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;    set&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; link no pap chap eap&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;    set&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; link enable chap-msv2&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;    set&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; link enable chap&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;    set&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; link keep-alive&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 10 60&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;# We reducing link mtu to avoid GRE packet fragmentation.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;    set&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; link mtu&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 1400&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;# Configure l2tp&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;    set&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; l2tp self&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 0.0.0.0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;    set&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; l2tp enable length&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;    set&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; l2tp disable dataseq&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;# Allow to accept calls&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;    set&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; link enable incoming&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;An example of the &lt;code&gt;mpd.secret&lt;/code&gt; file:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;username1 password 172.16.13.3&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;username2 password&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;* !/external/script&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;strongswan&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#strongswan&quot; aria-label=&quot;Anchor link for: strongswan&quot;&gt;🔗&lt;/a&gt;strongswan&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;ipsec.conf&lt;/code&gt; file:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; setup&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    strictcrlpolicy&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;no&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;conn&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; %default&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ikelifetime&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;8h&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ike&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;aes256-sha1-modp1024!&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    esp&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;aes256-sha1!&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    dpdaction&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;clear&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    dpddelay&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;300s&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    rekey&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;no&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    left&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;%any&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    leftsubnet&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;0.0.0.0/0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    leftid&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;@vpn.test&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    leftcert&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;vpnHostCert.pem&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    right&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;%any&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    auto&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;add&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;conn&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; L2TP-IPSec-PSK&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    type&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;transport&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    leftauth&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;psk&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    rightauth&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;psk&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The &lt;code&gt;ipsec.secrets&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;: PSK &amp;quot;the-shared-secret-key&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&quot;pf-nat&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#pf-nat&quot; aria-label=&quot;Anchor link for: pf-nat&quot;&gt;🔗&lt;/a&gt;PF NAT&lt;/h3&gt;
&lt;p&gt;High are the changes you will require to use
&lt;a rel=&quot;external&quot; href=&quot;https://en.wikipedia.org/wiki/Network_address_translation&quot;&gt;NAT&lt;/a&gt;
in that case this configuration may help:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;scrub&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; in all&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;nat&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; on xn0 from !xn0:0 to any&lt;/span&gt;&lt;span&gt; -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span&gt; (xn0)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;set&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; skip on lo&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;pass&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; all&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>openssl cheat sheet</title>
        <published>2016-06-22T13:37:44+02:00</published>
        <updated>2016-06-22T13:37:44+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/openssl-cheat-sheet/"/>
        <id>https://nbari.com/openssl-cheat-sheet/</id>
        
        <content type="html" xml:base="https://nbari.com/openssl-cheat-sheet/">&lt;p&gt;To display the contents of a &lt;a rel=&quot;external&quot; href=&quot;http://serverfault.com/a/9717/94862&quot;&gt;PEM&lt;/a&gt; formatted certificate:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ openssl x509 -in the-cert.pm -text&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Connecting to the server:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ openssl s_client -showcerts -connect imap.ejemplo.org:993 &amp;lt; /dev/null&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Test smtp 587:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ openssl s_client -host smtp.gmail.com -port 587 -starttls smtp -crlf&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Checking the Validity Date:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ openssl s_client -showcerts -connect nbari.com:443 2&amp;gt;/dev/null | openssl x509 -noout -dates&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Encode base64 a file:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ openssl enc -base64 -in file.txt -out file.txt.enc&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;if no ssl: python -m base64 -d&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Create pair of keys (self signed certificate):&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ openssl req -x509 -newkey rsa:4096 -sha256 -nodes -keyout example.key -out example.crt -subj &amp;quot;/CN=example.com&amp;quot; -days 3650&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Test speed of signatures:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ openssl speed sha256 sha512&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Change pass-phrase of a key, you will need to specify the old pass-phrase and
then spedify a new one:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ openssl rsa -des3 -in example.key -out example.key.new&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;encrypt-decrypt&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#encrypt-decrypt&quot; aria-label=&quot;Anchor link for: encrypt-decrypt&quot;&gt;🔗&lt;/a&gt;encrypt / decrypt&lt;/h2&gt;
&lt;p&gt;Encrypt:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ openssl aes-256-cbc -a -salt -in file.txt -out file.txt.enc&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Decrypt:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ openssl aes-256-cbc -d -a -in file.txt.enc -out file.txt&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>FreeBSD jails</title>
        <published>2016-06-19T17:24:05+02:00</published>
        <updated>2016-06-19T17:24:05+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/jails/"/>
        <id>https://nbari.com/jails/</id>
        
        <content type="html" xml:base="https://nbari.com/jails/">&lt;p&gt;The &lt;a rel=&quot;external&quot; href=&quot;https://www.freebsd.org/doc/handbook/jails.html&quot;&gt;FreeBSD jail&lt;/a&gt; mechanism
is an implementation of &lt;em&gt;operating system-level virtualization&lt;/em&gt; that allows
administrators to partition a FreeBSD-based computer system into several
independent mini-systems called jails.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Operating-system-level virtualization&lt;/strong&gt; is a server virtualization method in which
the kernel of an operating system allows the existence of multiple isolated
user-space instances, instead of just one. Such instances, which are sometimes
called containers, software containers, virtualization engines (VEs) or jails
(FreeBSD jail or chroot jail), may look and feel like a real server from the
point of view of its owners and users.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;On Unix-like operating systems, this technology can be seen as an advanced
implementation of the standard chroot mechanism. In addition to isolation
mechanisms, the kernel often provides resource-management features to limit the
impact of one container&#39;s activities on other containers.&lt;/p&gt;
&lt;h1 id=&quot;freebsd-the-big-picture&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#freebsd-the-big-picture&quot; aria-label=&quot;Anchor link for: freebsd-the-big-picture&quot;&gt;🔗&lt;/a&gt;FreeBSD the big picture&lt;/h1&gt;
&lt;p&gt;&lt;img src=&quot;/img/jails.png&quot; alt=&quot;jails&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;&lt;/p&gt;
&lt;h1 id=&quot;freebsd-jails-docker&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#freebsd-jails-docker&quot; aria-label=&quot;Anchor link for: freebsd-jails-docker&quot;&gt;🔗&lt;/a&gt;FreeBSD jails != docker&lt;/h1&gt;
&lt;p&gt;Jails are rock solid proven technology used by
&lt;a rel=&quot;external&quot; href=&quot;https://www.freebsd.org/doc/handbook/nutshell.html&quot;&gt;many companies&lt;/a&gt;
the workflow and concept is very different from &lt;a rel=&quot;external&quot; href=&quot;http://www.docker.com&quot;&gt;docker&lt;/a&gt;
and because of that is not possible to do a comparison between them.&lt;/p&gt;
&lt;p&gt;Try to compare them is difficult and unfair, for example, doing a very bad
analogy I would say that &lt;a rel=&quot;external&quot; href=&quot;http://kubernetes.io/&quot;&gt;kubernetes&lt;/a&gt; + Docker is
something similar to what you get when using &lt;strong&gt;jails&lt;/strong&gt; on the Linux ecosystem,
not even mentioning the &lt;a rel=&quot;external&quot; href=&quot;https://www.freebsd.org/doc/handbook/zfs.html&quot;&gt;ZFS&lt;/a&gt;
capabilities and full network stack support available within a jail.&lt;/p&gt;
&lt;h1 id=&quot;creating-a-jail&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#creating-a-jail&quot; aria-label=&quot;Anchor link for: creating-a-jail&quot;&gt;🔗&lt;/a&gt;Creating a jail&lt;/h1&gt;
&lt;p&gt;Create the dataset for the jails:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# zfs create -o mountpoint=/jails tank/jails&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# zfs create tank/jails/base&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>OSI model</title>
        <published>2016-06-19T01:14:50+02:00</published>
        <updated>2016-06-19T01:14:50+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/osi/"/>
        <id>https://nbari.com/osi/</id>
        
        <content type="html" xml:base="https://nbari.com/osi/">&lt;blockquote&gt;
&lt;p&gt;The Open Systems Interconnection model (OSI model) is a conceptual model
that characterizes and standardizes the communication functions of a
telecommunication or computing system without regard to their underlying
internal structure and technology.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;img src=&quot;/img/osi.gif&quot; alt=&quot;osi model&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;&lt;/p&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://en.wikipedia.org/wiki/List_of_network_protocols_(OSI_model)&quot;&gt;List of newtork protocols&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/img/osi-example.png&quot; alt=&quot;example&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;&lt;/p&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;http://www.haproxy.org/&quot;&gt;HAProxy&lt;/a&gt; can work as a Load Balancer in Layer 4 (tcp mode) and Layer 7.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/img/haproxy_layers.png&quot; alt=&quot;HAProxy&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Port knocking</title>
        <published>2016-06-19T01:02:10+02:00</published>
        <updated>2016-06-19T01:02:10+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/portknocking/"/>
        <id>https://nbari.com/portknocking/</id>
        
        <content type="html" xml:base="https://nbari.com/portknocking/">&lt;blockquote&gt;
&lt;p&gt;In computer networking, port knocking is a method of externally opening ports on
a firewall by generating a connection attempt on a set of prespecified closed
ports. Once a correct sequence of connection attempts is received, the firewall
rules are dynamically modified to allow the host which sent the connection
attempts to connect over specific port(s).&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;For example, Using &lt;a rel=&quot;external&quot; href=&quot;https://www.freebsd.org/doc/handbook/firewalls-pf.html&quot;&gt;PF&lt;/a&gt; on &lt;a rel=&quot;external&quot; href=&quot;http://www.freebsd.org&quot;&gt;FreeBSD&lt;/a&gt; to only open &lt;code&gt;port 22&lt;/code&gt; after X number of
attempts to connect on &lt;code&gt;port 1234&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;# Table for allowed IPs - gets auto populated via portknocking&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;table&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;lt;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;portknock_ss&lt;/span&gt;&lt;span&gt;h&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; persist&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;block&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; drop&lt;/span&gt;&lt;span class=&quot;z-1 z-i&quot;&gt; # block policy&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;# Allow everyone to hit &amp;#39;any&amp;#39; on port &amp;#39;1234&amp;#39; - pf proxies tcp connection&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;#  [if not using &amp;#39;synproxy&amp;#39;, the connection is never established to&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;#    &amp;#39;overload&amp;#39; the rule]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;#  5 attempts in 15 seconds&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;pass&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; in log quick proto tcp from any to any port {&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;1234&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;} synproxy state&lt;/span&gt;&lt;span&gt; \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  (max-src-conn-rate&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; 5/15, overload&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;lt;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;portknock_ss&lt;/span&gt;&lt;span&gt;h&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;#Allow IPs that have been &amp;#39;overload&amp;#39;ed into the portknock_ssh table&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;pass&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; in log quick proto tcp from {&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;portknock_ss&lt;/span&gt;&lt;span&gt;h&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;} to any port {ssh}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;# Allow out trafic&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;pass&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; out all&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In case you want to use this on an AWS instance using also VPN (NAT):&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;table &amp;lt;portknock_ssh&amp;gt; persist&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;scrub in all&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;nat on xn0 from !xn0:0 to any -&amp;gt; (xn0)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;set skip on {lo0, tun0, ng0}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pass in log quick proto tcp from any to any port {1234} synproxy state \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  (max-src-conn-rate 5/15, overload &amp;lt;portknock_ssh&amp;gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pass in log quick proto tcp from {&amp;lt;portknock_ssh&amp;gt;} to any port {ssh}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;block in quick on xn0 proto tcp to port ssh&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pass all&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;An entry in &lt;code&gt;/etc/crontab&lt;/code&gt; or a expiretable could be used to expire all IP&#39;s
in that table that have not been referenced in 60 seconds:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;* * * * *       root    /sbin/pfctl -vt portknock_ssh -T expire 60&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h1 id=&quot;how-to-nock&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#how-to-nock&quot; aria-label=&quot;Anchor link for: how-to-nock&quot;&gt;🔗&lt;/a&gt;how to nock&lt;/h1&gt;
&lt;p&gt;Via terminal:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ for i in {1..10}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;nc -z host.tld 1234&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Connection to host.tld port 1234 [tcp/search-agent] succeeded!&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Connection to host.tld port 1234 [tcp/search-agent] succeeded!&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Connection to host.tld port 1234 [tcp/search-agent] succeeded!&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Connection to host.tld port 1234 [tcp/search-agent] succeeded!&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Connection to host.tld port 1234 [tcp/search-agent] succeeded!&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;On the server to see the current IP on the &lt;code&gt;portknock_ssh&lt;/code&gt; table:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ pfctl -t portknock_ssh -T show&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;96.129.22.100&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;10.0.2.34&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Hugo hosting on github using 2 repositories</title>
        <published>2016-06-19T00:45:05+02:00</published>
        <updated>2016-06-19T00:45:05+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/hugo-hosting/"/>
        <id>https://nbari.com/hugo-hosting/</id>
        
        <content type="html" xml:base="https://nbari.com/hugo-hosting/">&lt;p&gt;This setup requires two separate repos, one for Hugo&#39;s content, and a second one
that will be a git submodule with the &lt;code&gt;public&lt;/code&gt; folder&#39;s content in it.&lt;/p&gt;
&lt;p&gt;Step by step:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Create on Github &lt;code&gt;&amp;lt;your-project&amp;gt;-hugo&lt;/code&gt; repository (it will host Hugo’s
content)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Create on GitHub &lt;code&gt;&amp;lt;username&amp;gt;.github.io&lt;/code&gt; repository (it will host the public
folder: the static website)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;git clone &amp;lt;your-project&amp;gt;-hugo-url &amp;amp;&amp;amp; cd &amp;lt;your-project&amp;gt;-hugo&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Make your website work locally (hugo server)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Once you are happy with the results, &lt;code&gt;Ctrl+C&lt;/code&gt; (kill server) and &lt;code&gt;rm -rf public&lt;/code&gt;
(don’t worry, it can always be regenerated with hugo)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;git submodule add -b master git@github.com:&amp;lt;username&amp;gt;/&amp;lt;username&amp;gt;.github.io.git public&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Almost done: add a &lt;code&gt;deploy.sh&lt;/code&gt; script to help you (and make it executable: chmod +x deploy.sh):&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;If submodule already exist you can do this:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ git submodule init&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ git pull --recurse-submodules&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The &lt;code&gt;deploy.sh&lt;/code&gt; script:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;#!/bin/sh&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;echo&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;\033[0;32mDeploying updates to GitHub...\033[0m&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;# Build the project.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;hugo&lt;/span&gt;&lt;span class=&quot;z-1 z-i&quot;&gt; # if using a theme, replace by `hugo -t &amp;lt;yourtheme&amp;gt;`&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;# Go To Public folder&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;cd&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; public&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;# Add changes to git.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; add -A&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;# Commit changes.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;msg&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;rebuilding site &lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;z-12&quot;&gt;date&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;`&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; [&lt;/span&gt;&lt;span&gt; $#&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; -eq&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; 1&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; ]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;  then&lt;/span&gt;&lt;span&gt; msg&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;=&amp;quot;&lt;/span&gt;&lt;span class=&quot; z-i&quot;&gt;$1&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;fi&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; commit -m&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span&gt;$msg&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;# Push source and build repos.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-12&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; push origin master&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1 z-i&quot;&gt;# Come Back&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-2&quot;&gt;cd&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; ..&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Run &lt;code&gt;./deploy.sh &quot;Your optional commit message&quot;&lt;/code&gt; to send changes to
&lt;code&gt;&amp;lt;username&amp;gt;.github.io&lt;/code&gt; (careful, you may also want to commit changes on the
&lt;code&gt;&amp;lt;your-project&amp;gt;-hugo&lt;/code&gt; repo).&lt;/p&gt;
&lt;p&gt;Source: https://gohugo.io/tutorials/github-pages-blog/&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>AWS VPC</title>
        <published>2016-06-18T19:44:31+02:00</published>
        <updated>2016-06-18T19:44:31+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/aws-vpc/"/>
        <id>https://nbari.com/aws-vpc/</id>
        
        <content type="html" xml:base="https://nbari.com/aws-vpc/">&lt;blockquote&gt;
&lt;p&gt;Amazon Virtual Private Cloud (Amazon VPC) enables you to launch Amazon Web
Services (AWS) resources into a virtual network that you&#39;ve defined. This
virtual network closely resembles a traditional network that you&#39;d operate in
your own data center, with the benefits of using the scalable infrastructure of
AWS.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;img src=&quot;/img/vpc.png&quot; alt=&quot;VPC&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;&lt;/p&gt;
&lt;h1 id=&quot;things-to-keep-in-mind&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#things-to-keep-in-mind&quot; aria-label=&quot;Anchor link for: things-to-keep-in-mind&quot;&gt;🔗&lt;/a&gt;Things to keep in mind.&lt;/h1&gt;
&lt;h2 id=&quot;normalize-your-network&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#normalize-your-network&quot; aria-label=&quot;Anchor link for: normalize-your-network&quot;&gt;🔗&lt;/a&gt;Normalize your network&lt;/h2&gt;
&lt;p&gt;First of all, do not invent IP&#39;s, please use and
create a normalized range using the private ranges:
https://en.wikipedia.org/wiki/Classful_network#Introduction_of_address_classes&lt;/p&gt;
&lt;p&gt;If you chose something like &lt;code&gt;10.0.0.0/16&lt;/code&gt; (class A),
create your segments in ascending order, for example for the
&lt;strong&gt;public&lt;/strong&gt; segment (color yellow in the above image) in where instances can get an
[Elastic IP Address](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/elastic-ip-addresses -eip.html)
create small segments, something like:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;10.0.0.0/24&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;10.0.1.0/24&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;10.0.2.0/24&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;mask 24 gives you 254 available IP&#39;s&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;For the &lt;strong&gt;private&lt;/strong&gt; segment (color green) in where instances need
&lt;a rel=&quot;external&quot; href=&quot;https://en.wikipedia.org/wiki/Network_address_translation&quot;&gt;NAT&lt;/a&gt; you can crate
bigger segments (2046 hosts per segment):&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;10.0.8.0/21&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;10.0.16.0/21&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;10.0.24.0/21&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;mask 21 gives you 2046 available IP&#39;s&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;http://jodies.de/ipcalc&quot;&gt;IPCalc&lt;/a&gt; can help you get going while setting your network:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ brew install ipcalc&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;avoid-using-an-ssh-bastion-host&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#avoid-using-an-ssh-bastion-host&quot; aria-label=&quot;Anchor link for: avoid-using-an-ssh-bastion-host&quot;&gt;🔗&lt;/a&gt;Avoid using an SSH Bastion Host&lt;/h2&gt;
&lt;p&gt;If possible, the order of preference instead of having an instance listening for
ssh connection:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Create a &lt;a rel=&quot;external&quot; href=&quot;http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_VPN.html&quot;&gt;hardware VPN&lt;/a&gt; between your office and AWS.&lt;/li&gt;
&lt;li&gt;Use a VPN instance with &lt;a rel=&quot;external&quot; href=&quot;https://openvpn.net/&quot;&gt;openvpn&lt;/a&gt; or &lt;a rel=&quot;external&quot; href=&quot;https://en.wikipedia.org/wiki/Layer_2_Tunneling_Protocol&quot;&gt;L2TP&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;If you still want to use a Bastion Host, at least chagne the default SSH port, or implement &lt;a href=&quot;/post/portknocking/&quot;&gt;portknocking&lt;/a&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;To keep it short the whole point of this is security. If you are already setting
up a VPC, try to stick to it, the idea at the end is to have an infrastructure
capable of scaling and running your applications as easy as possible but keeping
in mind security.&lt;/p&gt;
&lt;h2 id=&quot;nat-gateway&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#nat-gateway&quot; aria-label=&quot;Anchor link for: nat-gateway&quot;&gt;🔗&lt;/a&gt;NAT GATEWAY&lt;/h2&gt;
&lt;p&gt;You can only have NAT GATEWAY for all subnets, just be sure to attach it to the public segment.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/img/nat-gateway-diagram.png&quot; alt=&quot;nat gateway&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;&lt;/p&gt;
&lt;h1 id=&quot;network-segments&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#network-segments&quot; aria-label=&quot;Anchor link for: network-segments&quot;&gt;🔗&lt;/a&gt;Network segments&lt;/h1&gt;
&lt;p&gt;Based on the &lt;a rel=&quot;external&quot; href=&quot;http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html&quot;&gt;availability zones&lt;/a&gt; (&lt;strong&gt;A-Z&lt;/strong&gt;) the public segment is partitioned in small subnets of 255 hosts:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;public A segment &lt;code&gt;10.10.0.0/24&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;public B segment &lt;code&gt;10.10.1.0/24&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you were using EU(Ireland) you could add a &lt;code&gt;public C&lt;/code&gt; segment:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;public C segment &lt;code&gt;10.10.2.0/24&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Within &lt;code&gt;10.10.0.0/21&lt;/code&gt; you can create up to 8 subnets of 254 hosts each (a, b, c, d, e, f, g, h) so it gives plenty of space for the public segment.&lt;/p&gt;
&lt;h2 id=&quot;private-segment&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#private-segment&quot; aria-label=&quot;Anchor link for: private-segment&quot;&gt;🔗&lt;/a&gt;Private segment&lt;/h2&gt;
&lt;p&gt;Same as the &lt;strong&gt;public&lt;/strong&gt; segment the &lt;strong&gt;private&lt;/strong&gt; segment is created based on the availability zones, with the main difference that segments are bigger (mask 21 - 2046 hosts), this is because  almost all the instances reside in the private segments.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;private A segment &lt;code&gt;10.10.8.0/21&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;private B segment &lt;code&gt;10.10.16.0/21&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;segments-based-on-the-availability-zones&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#segments-based-on-the-availability-zones&quot; aria-label=&quot;Anchor link for: segments-based-on-the-availability-zones&quot;&gt;🔗&lt;/a&gt;Segments based on the availability zones&lt;/h2&gt;
&lt;p&gt;When you create the subnets you are available to chose a &lt;code&gt;zone&lt;/code&gt; or to chose &lt;code&gt;No preference&lt;/code&gt; the idea in this case of specifying a zone is that when doing &lt;a rel=&quot;external&quot; href=&quot;https://aws.amazon.com/autoscaling/&quot;&gt;autoscaling&lt;/a&gt; you can have more control and prevent in advance in case of a failure happens. For example you could create an Load balancer and attach 2 instances each in one zone (A, B) in case of a failure in zone A, you still having an instance in zone B so your application still up and running.&lt;/p&gt;
&lt;h2 id=&quot;why-public-and-private-segments&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#why-public-and-private-segments&quot; aria-label=&quot;Anchor link for: why-public-and-private-segments&quot;&gt;🔗&lt;/a&gt;Why public and private segments&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Public&lt;/strong&gt; segments are the ones don&#39;t use a &lt;a rel=&quot;external&quot; href=&quot;http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/vpc-nat-gateway.html&quot;&gt;NAT gateway&lt;/a&gt; and need an &lt;a rel=&quot;external&quot; href=&quot;http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/elastic-ip-addresses-eip.html&quot;&gt;elastic/public IP&lt;/a&gt; to be available to operate, therefore this segment is used for load balancer(ELB, HAproxy), vpn/bastion hosts or instances that need to be exposed and reached directly outside the VPN.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Private&lt;/strong&gt; segments require a NAT gateway and can not be reached from the outside, if you attach/allocate a public IP to an instance located within the private segment, it simple will not work.&lt;/p&gt;
&lt;p&gt;Some of the benefits with this approach:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Inherit security from VPC (no need to create multiple security groups).&lt;/li&gt;
&lt;li&gt;Less use of elastic IP&#39;s.&lt;/li&gt;
&lt;li&gt;Common IP&#39;s for all outgoing requests.&lt;/li&gt;
&lt;/ul&gt;
</content>
        
    </entry>
</feed>
