<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: ductapedev</title>
    <description>The latest articles on DEV Community by ductapedev (@ductapedev).</description>
    <link>https://dev.to/ductapedev</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F615832%2F6f97b86a-5188-46d5-94ca-19f9479d6292.png</url>
      <title>DEV Community: ductapedev</title>
      <link>https://dev.to/ductapedev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ductapedev"/>
    <language>en</language>
    <item>
      <title>Install `docker-compose` on NVIDIA Jetson Nano</title>
      <dc:creator>ductapedev</dc:creator>
      <pubDate>Tue, 17 Aug 2021 01:45:57 +0000</pubDate>
      <link>https://dev.to/ductapedev/install-docker-compose-on-nvidia-jetson-nano-2oe</link>
      <guid>https://dev.to/ductapedev/install-docker-compose-on-nvidia-jetson-nano-2oe</guid>
      <description>&lt;p&gt;When working with &lt;a href="https://developer.nvidia.com/jetpack-sdk-451-archive"&gt;Jetpack 4.5.1&lt;/a&gt; for NVIDIA Jetson Nano, it comes with Docker installed, but not &lt;code&gt;docker-compose&lt;/code&gt;. And because the Nano is &lt;strong&gt;arm64&lt;/strong&gt; CPU architecture, installing Docker Compose is not straight forward. There are a number of existing tutorials listed in the references section, but none of them worked exactly as-is for me, or some of them have slightly bloated or less secure instructions that I would prefer. So here is my lean, mean, securely-installing &lt;del&gt;machine&lt;/del&gt; instructions. &lt;/p&gt;

&lt;h2&gt;
  
  
  Install prerequisites
&lt;/h2&gt;

&lt;p&gt;Make sure your Ubuntu installation is up to date with the usual apt-get commands&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt-get update &amp;amp;&amp;amp; sudo apt-get upgrade -y
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Install necessary Ubuntu packages
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt-get install -y python3-pip libssl-dev python-openssl libffi-dev rustc cargo 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now the default version of &lt;a href="https://pypi.org/project/pip"&gt;pip&lt;/a&gt; and &lt;a href="https://pypi.org/project/setuptools"&gt;setuptools&lt;/a&gt; that ships with Jetpack 4.5.1 is not new enough to successfully install &lt;code&gt;docker-compose&lt;/code&gt;. Those need to be upgraded before continuing. You can upgrade to the newest version, but here are the versions that I tested.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;python3 -m pip install --upgrade pip==21.1.3 setuptools==56.2.0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, once those are upgraded you can install Docker Compose. Docker Compose needs to be installed as root to give it access to the low-level system resources it needs to execute the installer.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo -H python3 -m pip install docker-compose==1.29.2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And after that completes, you should be able to get the version with &lt;code&gt;docker-compose --version&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Docker without &lt;code&gt;sudo&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;One thing that can be really annoying when using the default Jetpack version of docker is that you have to run everything with &lt;code&gt;sudo&lt;/code&gt;. Here are the steps to add your user as part of the docker group.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo groupadd docker
sudo usermod -aG docker $USER
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then log out and log back in as your user to make sure all the settings are applied properly. No more sudo! &lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://developer.nvidia.com/jetpack-sdk-451-archive"&gt;https://developer.nvidia.com/jetpack-sdk-451-archive&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.docker.com/engine/install/linux-postinstall/"&gt;https://docs.docker.com/engine/install/linux-postinstall/&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;&lt;a href="https://dev.to/docker/install-docker-compose-1-28-2-on-nvidia-jetson-nano-is-not-straightforward-3952"&gt;https://dev.to/docker/install-docker-compose-1-28-2-on-nvidia-jetson-nano-is-not-straightforward-3952&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://collabnix.com/running-docker-compose-on-nvidia-jetson-nano-in-5-minutes/"&gt;https://collabnix.com/running-docker-compose-on-nvidia-jetson-nano-in-5-minutes/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>nvidia</category>
      <category>docker</category>
      <category>containers</category>
      <category>infrastructure</category>
    </item>
    <item>
      <title>Passwordless SSH on Raspberry Pi</title>
      <dc:creator>ductapedev</dc:creator>
      <pubDate>Tue, 17 Aug 2021 00:34:21 +0000</pubDate>
      <link>https://dev.to/ductapedev/passwordless-ssh-on-raspberry-pi-4l60</link>
      <guid>https://dev.to/ductapedev/passwordless-ssh-on-raspberry-pi-4l60</guid>
      <description>&lt;p&gt;This post is a reference for me and others who wants to improve their InfoSec hygiene. As a software engineer who deals with lots of servers, accounts, and IoT devices, one common task that is a daily routine is to SSH into various computers. SSH commonly is based on username and password. For Raspbian, the &lt;a href="https://www.raspberrypi.org/documentation/computers/using_linux.html#:~:text=User%20management%20in%20Raspberry%20Pi,and%20change%20each%20user%27s%20password."&gt;default&lt;/a&gt; is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;raspberrypi login: pi
Password: raspberry
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Which is convenient for starting out with a new board, or for new users. But this is not the most secure, especially when enabling SSH to connect into your devices remotely (even if just for engineering and development).  I've never been guilty of forgetting to change the default login on the devices I leave connected to my network. 🙄  Having those devices around on your engineering and development network makes a great pivot for attackers (see &lt;a href="https://en.wikipedia.org/wiki/Mirai_(malware)"&gt;Mirai&lt;/a&gt;). &lt;/p&gt;

&lt;p&gt;Let's start with a Raspberry Pi device. &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Connect to your Raspberry Pi device over the serial port, or by using a monitor and keyboard and log in. &lt;/li&gt;
&lt;li&gt;Use the raspi-config to configure Wi-Fi or plug in Ethernet cable.&lt;/li&gt;
&lt;li&gt;Enable SSH&lt;/li&gt;
&lt;li&gt;Upload your SSH public key using ssh-copy-id. This automatically creates the .ssh directory with the correct permissions and puts your public key in the authorized_keys file.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ssh-copy-id pi@[ip_address]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;NOTE:&lt;/strong&gt; Sometimes, if you are using a key-manager like &lt;a href="https://krypt.co/"&gt;Krypt.co&lt;/a&gt; you will not have the typical &lt;code&gt;.pub&lt;/code&gt; file to copy, in which case using &lt;code&gt;ssh-copy-id -f&lt;/code&gt; option will force it to copy anything close to a public key and this works for me.  &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Disable the password/challenge-response login so that only your SSH key will work. (But first, make a backup in case you make a mistake! If you do make a mistake, you will have to connect directly to the UART or have a local mouse/monitor/keyboard to fix it and the backup file will be super handy)
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak
sudo vi /etc/ssh/sshd_config
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Uncomment and/or set the following parameters in the sshd_config.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ChallengeResponseAuthentication no
...
PasswordAuthentication no
...
UsePAM no
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then restart the ssh server.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo systemctl reload ssh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Downsides
&lt;/h3&gt;

&lt;p&gt;Now, once you disable password/challenge response login, you get the benefits of increased security that no-one can access your pi without being in the authorized_keys file. However, if you ever lose your SSH private key, you can no longer get into your Pi remotely. But, with commodity hardware like raspberry pi, you can always pull the SD card and manually edit the authorized_keys file, or just reflash the card and start again, or connect using a local keyboard/monitor/mouse or via the UART console. &lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;p&gt;Original base of Cover Photo by &lt;a href="https://unsplash.com/@alex13naf?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText"&gt;Takacs Alexandra&lt;/a&gt; on &lt;a href="https://unsplash.com/s/photos/key?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText"&gt;Unsplash&lt;/a&gt;, modified by me to add Raspberry Pi. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.cyberciti.biz/faq/how-to-disable-ssh-password-login-on-linux/"&gt;https://www.cyberciti.biz/faq/how-to-disable-ssh-password-login-on-linux/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://phoenixnap.com/kb/setup-passwordless-ssh"&gt;https://phoenixnap.com/kb/setup-passwordless-ssh&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://community.perforce.com/s/article/6210#:%7E:text=ssh%20directory%20permissions%20should%20be,-----"&gt;https://community.perforce.com/s/article/6210#:~:text=ssh%20directory%20permissions%20should%20be,-----&lt;/a&gt;).&lt;/p&gt;

</description>
      <category>security</category>
      <category>pki</category>
      <category>ssh</category>
      <category>raspberrypi</category>
    </item>
    <item>
      <title>Installing Krypt.co on NVIDIA Jetson Nano</title>
      <dc:creator>ductapedev</dc:creator>
      <pubDate>Wed, 21 Jul 2021 20:54:40 +0000</pubDate>
      <link>https://dev.to/ductapedev/installing-krypt-co-on-nvidia-jetson-nano-1ddn</link>
      <guid>https://dev.to/ductapedev/installing-krypt-co-on-nvidia-jetson-nano-1ddn</guid>
      <description>&lt;p&gt;When writing software that will perform AI on the edge, the NVIDIA Jetson Nano devboard is a great piece of hardware to play with. It's a 64-bit ARMv8 CPU architecture. &lt;/p&gt;

&lt;p&gt;In order to create a smooth user experience of moving between development machines, I use &lt;a href="https://krypt.co"&gt;krypt.co&lt;/a&gt; to &lt;strong&gt;manage the private keys for my SSH and GPG key pairs.&lt;/strong&gt; This gives me the security benefit that access to my development machine doesn't give anyone "access" to connect to any SSH connections, or to sign anything with my GPG key. Secondly, this allows me to use 2FA for my SSH and GPG keys. The major downside is that Krypton was acquired by Akamai and at some point in the future, the krypt.co service will have to be shut down :(. Second issue is that my phone is now the guardian of my private keys. &lt;/p&gt;

&lt;p&gt;Anyway, let's assume that you also want to use Krypt.co, and that you want to use an NVIDIA Jetson Nano as your dev machine. The problem with this, is that Krypton doesn't maintain an executable of the Linux &lt;code&gt;kr&lt;/code&gt; utility for the ARM64 CPU architecture in Linux (Debian flavors-- the Jetson Nano OS is based on Ubuntu). Luckily, Krypton gives you the instructions to build their &lt;code&gt;kr&lt;/code&gt; utility from source! &lt;/p&gt;

&lt;p&gt;We are going to follow the &lt;a href="https://krypt.co/docs/start/installation.html"&gt;Krypt.co installer instructions&lt;/a&gt; to install &lt;code&gt;kr&lt;/code&gt; from source on ARM64 CPU architecture running &lt;a href="https://developer.nvidia.com/embedded/linux-tegra"&gt;Linux 4 Tegra (L4T)&lt;/a&gt; (an Ubuntu-flavored Linux distro). &lt;/p&gt;

&lt;h2&gt;
  
  
  Install the apps
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Golang
&lt;/h3&gt;

&lt;p&gt;Get the &lt;code&gt;ARM64&lt;/code&gt; build for Linux from the &lt;a href="https://golang.org/dl/"&gt;Golang downloads page&lt;/a&gt; and follow the &lt;a href="https://golang.org/doc/install"&gt;install instructions&lt;/a&gt; on the page. The download instructions might change, but here is what works for Go 1.16.7:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;wget --secure-protocol=TLSv1_2 --https-only https://golang.org/dl/go1.16.7.linux-arm64.tar.gz &amp;amp;&amp;amp; echo "63d6b53ecbd2b05c1f0e9903c92042663f2f68afdbb67f4d0d12700156869bac *go1.16.7.linux-arm64.tar.gz" | sha256sum -c -

# Make sure the result is "go1.16.7.linux-arm64.tar.gz: OK" which means the SHA256 has checked out.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is covered on the instructions page, but essentially, you &lt;code&gt;rm&lt;/code&gt; any old versions of go, and then untar the download you just downloaded into &lt;code&gt;/usr/local/go&lt;/code&gt; as the root user. Then remove the tarball because you are done with it. Here is how it works for Go 1.16.7:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo rm -rf /usr/local/go &amp;amp;&amp;amp; sudo tar -C /usr/local -xzf go1.16.7.linux-arm64.tar.gz &amp;amp;&amp;amp; rm go1.16.7.linux-arm64.tar.gz
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Handy tip:&lt;/strong&gt; use the &lt;code&gt;profile.d&lt;/code&gt; executor to add go to your path:&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo touch /etc/profile.d/go-bin-path.sh&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;Then put the following in that file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# shellcheck shell=sh

# Expand $PATH to include the directory where golang executable is.
go_bin_path="/usr/local/go/bin"
if [ -n "${PATH##*${go_bin_path}}" ] &amp;amp;&amp;amp; [ -n "${PATH##*${go_bin_path}:*}" ]; then
    export PATH=$PATH:${go_bin_path}
fi

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And next time you log into the shell session, you will have go installed. &lt;/p&gt;

&lt;h3&gt;
  
  
  Rustup
&lt;/h3&gt;

&lt;p&gt;While you can follow the official &lt;a href="https://rustup.rs/"&gt;rustup&lt;/a&gt; installation (which is pretty easy to install using their install script), we will use the Rust packages that are part of Canonical's Bionic package repository.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt-get install -y rustc cargo
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Install &lt;code&gt;kr&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Now here is where the instructions deviate from &lt;a href="https://krypt.co/docs/start/installation.html"&gt;the website&lt;/a&gt;. The &lt;code&gt;go get&lt;/code&gt; and such didn't really work out for me, but fetching the &lt;a href="https://github.com/kryptco/kr"&gt;kr repo&lt;/a&gt; directly from GitHub worked when I followed the README in the repo.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;wget --secure-protocol=TLSv1_2 --https-only https://github.com/kryptco/kr/archive/1937e31606e4dc0f7263133334d429f956502276.zip &amp;amp;&amp;amp; echo "b1bf4a46ee998b4489d880e443cafc435bbfca3184c1d199597b60ee8ba2edf6 *1937e31606e4dc0f7263133334d429f956502276.zip" | sha256sum -c -

# Make sure the ^ command results with "1937e31606e4dc0f7263133334d429f956502276.zip: OK" which means the SHA256 has was correct.

unzip 1937e31606e4dc0f7263133334d429f956502276.zip -d kr &amp;amp;&amp;amp; cd kr/kr-1937e31606e4dc0f7263133334d429f956502276
make install
make start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Using &lt;code&gt;kr&lt;/code&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Set up SSH
&lt;/h3&gt;

&lt;p&gt;Now that you have built and installed the &lt;code&gt;kr&lt;/code&gt; utility, all that is left is to pair to your Krypton account.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kr pair
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will configure your Jetson Nano and your Krypt.co account to use 2FA when accessing your SSH keys. &lt;/p&gt;

&lt;h3&gt;
  
  
  Git commit signing
&lt;/h3&gt;

&lt;p&gt;As mentioned above, &lt;code&gt;kr&lt;/code&gt; can also be used to sign your git commits. This is great if your repos require &lt;a href="https://docs.github.com/en/github/authenticating-to-github/managing-commit-signature-verification/about-commit-signature-verification"&gt;signed commits&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;All we have to do is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git config --global user.name "username"
git config --global user.email "username@email.com"
kr codesign
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now any time you make a &lt;code&gt;git commit&lt;/code&gt; your commits will use kr to prompt your phone to approve the use of your GPG key. &lt;/p&gt;

&lt;h2&gt;
  
  
  Cleaning up the build
&lt;/h2&gt;

&lt;p&gt;Now that you have installed and tested Krypton, you can clean up in the build files.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd ../../ # Or whatever directory you started in
rm -r 1937e31606e4dc0f7263133334d429f956502276.zip kr
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>security</category>
      <category>github</category>
      <category>pki</category>
      <category>computerscience</category>
    </item>
  </channel>
</rss>
