Michael Gagliano

Started from the bottom... and well we're here

Linux | Two Factor + SSH

Quick Guide

Recently I started making use of Oracle Cloud, due to their very generous “Always Free” tier. I’ve been pushing to learn more about Linux at large instead of staying within the Debian or CentOS guardrails.

Currently I have an ARM Ampere instance with Oracle Linux 8 that I use as a remote development box with VSCode. Occasionally it’ll serve a dual purpose of a beta host of software I’m working on.

Since this box holds development code and potentially unsecured software I wanted to ensure I protect it as much as possible. I realized it’s probably time to implement 2FA on SSH. I was hesitant due to VSCode integration concerns along with general maintenance ability with a verification implemented. Thankfully after testing, I found out VSCode natively handles keyboard-interactive type authentications.

Read more

Python | Webcam Activity Notifier

GitHub | Windows Client

Recently I’ve been on Zoom meetings and Discord video calls when my wife walks in aware there’s a webcam pointing in the general direction of the door. I’ve always joked about making an “On-Air” sign to let her know when I’m streaming or in a video call.

Last night I got into writing the basic code for accepting Zoom webhooks and generic requests (from my keyboard or another device). It ended up being fairly simple, creating a FastAPI endpoint with a pydantic model and it was up and running

I’m making use of a Raspberry Pi Zero W, which gives me the flexibility of putting it in a shadowbox with a battery pack for a week or so. It also allows me to wirelessly update the Pi and have it serve the web endpoint itself.

Read more

Docker | Screeps Private Server

Project Website

Screeps is a game that comes and goes out of my life, it is some of the most fun I have while also driving me insane more than any hobby has a right to do.

You surely remember Age of Empires, Rise of Nations, Galactic Battleground. The classics of RTS, but sometimes the units were just incredibly stupid. Opting to take the long way around the lake instead of the obvious shortcut between trees!

Turns out the developers of Screeps felt the same way. Screeps at it’s core is an RTS with you in control of the units actions. It relies on Javascript code to control small entities called Creeps. They are your units, a harvester, a miner, a fighter… really whatever you can cobble together in code, it can do.

Read more

Python | Wordle Start Word Ranker

Project Website | GitHub

I’m a little behind the curve, now that Wordle has been bought out by The New York Times. They immediately let us know they would be placing it behind a paywall, but there are literally dozens of us with Wordle clones ready to be of use

My project started with a discussion with my Dad. He tells me “stare” is a fantastic word to start with. He goes on about the vowels and common letters. I drop a far less appropriate word as a starter and assert surely my word is better!

I had no way of proving either way, but then I realized. I know how to program and I had been putting effort into learning Python at a more fundamental level for an upcoming job interview. I realized, this is a great showcase project.

Read more

Steam Proton | Stationeers

I’ve transitioned over to an Ubuntu desktop full time. I was tired of work being interrupted by unstable Windows updates along with frequent reboots that end in a failure. However, this means my normal collection of games had to be paired down to only Linux compatible games, it’s 2018 shouldn’t be hard right?

This process went fine, until I reached Stationeers. It was not supported by default and did not run at all when checking all the boxes Steam required to run non-tested games.

I sat for a week, just rebooting into Windows every time I wanted to play, but again, with every boot came another loop of updates that potentially could kill any motivation to game.

I finally sat down and decided to figure out how to get this game to run. The initial symptom was Stationeers would run, however a small box with a progress bar appeared, not the game launch. This guide resolves that issue, if you haven’t gotten that far, check out my notes on Proton and ext4
Read more

RPi | DIY Dashcam

I’m waiting on a TFT Touchscreen to come in for my kaliPi project, so I’m tinkering with my Raspberry Pi Zero W today. I have been wanting a dashcam for a while now, primarily due to the snowbird season incoming. I have seen other dashcams on Amazon but they all come with some less than stellar interfaces, so I figured I’d make my own.

This will be a headless and automated dashcam, meaning it will be powered on and record until shutdown. My first iteration of it will be a video only recording, until I can figure out a way to easily toggle the microphone for when I’m on the phone with clients.

The Parts List:

Note: I chose to go with the CanaKit Basics due to it including the standard Pi to Zero Camera cable. The basic kit also has a lid that perfectly fits the camera module for a compact solution.

The goal:

The primary focus is for the Pi to act as a dashcam, recording from the time it’s powered on until it’s turned off. My secondary goal is to incorporate GPS and acceleration logging as well. I enjoy visualizing data and it’d be cool to have those metrics. If there is enough processing room after those two goals, I may tack on a wardriving component. It would be one less device I need to carry around with me if I can fit that onto my dashcam.

Read more

I bought some Pi, Raspberry!

I’ve finally been bit by the bug. I purchased a CanaKit Raspberry Pi 3B Complete Starter Kit, I had thought I’d beat the system by purchasing everything separately. It turned out that it’s roughly the same price, give or take a sale. I opted for the kit for convenience mainly and it ended up having a nice printout of the GPIO and a quick start guide.

If this is your first Pi, I’d highly recommend a kit of some form. The kit included the black case, a micro-SD reader, a micro-SD card, 2.5A power supply, some heatsinks and naturally the Pi.

After purchasing it I realized I needed a project for it. Since I drive a lot for my job, I thought it’d be cool to start with GPS tracking. My thought being I could somehow make graphs and analyze my patterns, for science obviously. If I would be mapping GPS, why not add mapping wifi networks as well.

I’ve used Kali extensively in the past and knew I have seen touchscreen Pi projects with it. I decided to use KaliPi image for my first project, if you made the same mistake I have a few scripts and guides I’ve made along the line that I’ll tag with #kaliPi.  Since I was going with Kali, I knew I could get a Panda USB card to keep my Pi a compact project.

I had never worked with direct GPS devices before but I had the opportunity to buy a GPS HAT during a sale, but I opted for a USB GPS adapter instead. If for some reason I needed GPS on a computer or another Pi, I’d like the option to move it around.

I have been told there is a bit more jitter using a USB but that is only critical in an NTP source. I was willing to accept a slight degree of inaccuracy as long as it was still on the road somewhere. It’s surprisingly accurate, even at high speeds. The model I purchased has a magnet on the underside and it sticks to my dash. The only issue is when I’m between large buildings or a large concentration of trees.

The last piece of the puzzle was power. I know Raspberry Pi has an acceptable tolerance in deviation on their parts, so I wanted to see what MY Pi drew in terms of power. I bought a USB volt meter with tracking so I could take data points every 15 minutes and have it keep a running total overall.

After running the Pi in idle, wardriving, and GPS only modes I learned I needed about 8.7Ah of battery for 12 hour operation. On a random Amazon lightning deal I got a solar panel battery pack combo with 10Ah storage. The solar only outputs 3.5W @ 5V at full light but it’s enough to push my total runtime to around 16 hours.

I’m intending on posting weekly about my projects, primarily my reconPi project. I’m also interested in building my own z-wave controller for some basic home automation, keep an eye out for those posts as well.

JS | ASCII Text Display

While attempting to format my console output in hackmud, I found myself spending entirely too long formatting, copy, and pasting ASCII letters directly into a messy echo. I decided to write a script to display ASCII Text dynamically, by supplying an array of ASCII text broken down by row along with an display string.

Initially I attempted to concat strings whole letters at a time and found it too sloppy of a process and ultimately meant a messy output with little flexibility. I settled on taking the ASCII font a row at a time. Utilizing .indexOf() I compared the string letter against a string containing the alphabet and used that value to display the ASCII font. I looped through the display string each row and concated a row together before moving onto the next row. Finally displaying the rows separated by a new line character. I wanted the script to be more flexible allowing for variable width and height letters, so I included 2 parameters defining those dimensions.

I had originally wrote this in a golf friendly way. I have expanded the code slightly for readability, commented it and put it into a JSFiddle for you to explore and test.


FOGProject | Overview Ubuntu 16.04 Common Issues

This morning as I sat down to my desk, I decided to implement an imaging server to the workshop. We stock and deploy plenty of Dells on a regular basis so I was looking for a way to streamline our workflow. I had previous experience with Acronis and Norton Ghost, which were fantastic in a structured corporate environment. However, in a consultant position, they are less valuable and definitely not worth their license costs for my use case. I set out on my Googletrek with three criteria in my mind.

Three Criteria:

  1. Must be open source software, capable of being self hosted on a low-end computer
  2. Must be modular; meaning I am able to alter and augment the capture process and manipulate images afterwards
  3. Include a reporting and inventory system, this will be valuable for audit purposes

I discovered FOGProject and to my delight, it seemed to satisfy all of my criteria. It is completely OSS, with the ability to script and automate certain aspects of the imaging process, and incredibly includes a robust inventory system.  After seeing the vast community resources available, especially this in depth Installation Guide. I decided this was my solution. In my quest for using latest Ubuntu Server available, I caused myself 3 hours of headaches. It was a bad decision, I should have turned tail and installed 14.04. However, my head banging ends in a benefit for you as I’ve discovered the 3 most encountered issues with using FOGProject and Ubuntu 16.04.

Use the Git branch!

Seriously, don’t use 1.2.0. It will not work on Ubuntu 16.04, you might be able to Frankenstein some solution… but don’t do that. It’s quite simple to install FOGProject from Git. Version 1.3.0 of FOG will work on 16.04 within reason.

PHP-5? What’s that?

Ubuntu 16.04 does not have php-5 packages in their default repos and really that’s OK. php-7 has brought vast improvements in both performance and functions, which makes FOGProject just that more efficient. You’ll have to pass some variables to the installer script, but aside from that the developers have corrected the installer script from 1.2.0.

The official wiki suggests you use the -y option, however I prefer to know what my configuration values. I caught an improper IP address while installing on a virtual machine, so it never hurts to verify what your programs are doing.

MySQL WILL make you angry

For some reason I haven’t bothered to debug, MySQL and FOG don’t play well upon initial installation. My guess is that the issues arises from FOG using NO PASSWORD for root. Normally I’d be writing a strongly worded email to the developers, but being this will be used internally for simple OS deployment I’m not too shaken up about it. In order for you to install FOG properly, you will need to open another terminal or SSH session and set MySQL root user to blank.

Note: I encountered a second issue on my second development test. MySQL would not accept a connection period, if this is happening to you and you’ve verified the service is running and you’re root try the steps below:

Aside from these 3 problems, other errors will be mostly unknown. I suggest spending some time troubleshooting and then filing a bug report on their forums. The developers and community are quick to help you diagnose issues. Feel free to leave a comment if you’re still having issues with these issues, I’ll surely try to help you out.