# blog_post

title: 02/14/2025: MAKAYLA!!!
slug: 02-14-2025-makayla
images: ["IMG_0958.jpeg", "IMG_1048.jpeg", "IMG_9504.jpeg"]
category: My Awesome Girlfriend
tags: Valentines, Appreciation
content:
Happy Valentines Day everyone!  
<br>
<br>Today I would like to talk about someone very special. My girlfriend Makayla! We’ve been dating for over a year now, and I’ve never been happier.  
<br>
<br>Makayla is very special to me. It’s nice to wake up and know I have someone who will be there for me no matter what. Someone who will listen to my crazy ideas and goals, and even been there to help me with them! She’s been there for me from the start, and there’s nothing she wouldn’t do to help me succeed.  
<br>
<br>I hope that everyone can find a Makayla to be apart of their lives. She makes every day easier, and more fun.  
<br>
<br>Everything you’ve seen me do on my website, my GitHub, and my resume has been thanks to her. Before I even laid the groundwork to execute these ideas, I tell them to her. She’s the person I trust the most, and who I work for every day. My main goal in life is to make her happy, and I hope I can use my skills to accomplish that.  
<br>
<br>I love you Makayla. Happy Valentine’s Day! <3


# project_post

title: Coin Counting Device + Dashboard
slug: coin-counting-device-dashboard
images: ["IMG_1366.jpg", "IMG_1369.jpg", "IMG_1386.jpg"]
category: Hardware Design
tags: Raspberry Pi, SQL, Micropython, Flask, Hardware
content:
This was a project I had a lot of fun doing, and it taught me a lot not only about software and networking, but hardware as well.
<br>
<br>
<br>
<br>Part 1: Background   
<br>
<br>The story behind this project goes as follows:   I have a very large jar of coins. It has to weigh about 20 pounds as of today. I started collecting these coins over the summer, and I wanted to find a way to keep track of them. It would be great to know how many I have, what denominations, and how much total money I have.   
<br>
<br>Enter: The Raspberry Pi Pico WH     
<br>
<br>
<br>
<br>Part 2: The Pico   
<br>
<br>The Raspberry Pi Pico is a neat little device that I believe all programmers should tinker with at least once. It is similar to Arduino Microcontrollers, with some slight differences:   -The Arduino primarily work with the C Programming Language   -The Raspberry Pi Pico primarily works in the Micropython Programming Language   Micropython is almost exactly the same as plain old Python. However, it is lighter, and designed to perform better on lesser hardware. It is great for beginners attempting to learn hardware and the software that communicates with it.   
<br>
<br>The base-model Pico has no network-connectivity, and is just a simple microcontroller. The model I used, the Pico WH, not only has network connectivity, but came pre-soldered with headers to connect to a breadboard.      
<br>
<br>
<br>
<br>Part 3: The Logistics  
<br>
<br> I began by placing the Pico on a breadboard. And learned quite a lot about wiring as I began finding the best way to wire the screen and buttons I needed. 
<br>
<br>The layout was as follows:   
<br>
<br> -Upon booting up, the pico attempts to connect to the internet. It will not let you perform any actions until you do. My wifi settings are configured on the pico itself.  
<br>
<br> -The four small buttons represent the four main denominations of coins (Penny, Nickel, Dime, Quarter).  
<br>
<br> -The screen communicates with the Pico, which updates the screen on how many times the buttons have been pressed.    
<br>
<br>-The Big Red button collects the data from the button-presses, packages it up, and ships it away for storage.   
<br>
<br>But where does the data go?      
<br>
<br>
<br>Part 4: The Server   
<br>
<br>Upon pressing the red button, the data is packaged up and sent on a trip over the internet. This data ends up on my web-server! In a SQL database. This data gets formatted into a nice, readable format I can check at anytime.   
<br>
<br>You can actually view this coin database too! If you navigate to https://www.coins.benjaminmosley.com. 
<br>
<br>I left it open to the public, as the pages are static, (No CRUD features) as the only way to update the coin count is in one of two ways:    
<br>
<br>-Using the coin device   
<br>
<br>-Manipulating the SQL database on the server-side   
<br>
<br>Therefore, I am happy to let people visit the site and see what I have built. All of the code I used is present on my github as well, (Link is on the front page) if you would like to view it, and perhaps build your own!  Thank you for reading, I hope you found this as interesting as I did!
<br>


title: Setting Up My Own Email Server
slug: setting-up-my-own-email-server
images: ["Screenshot_2025-04-16_at_1.11.50_PM.png", "Screenshot_2025-04-16_at_1.13.14_PM.png"]
category: Networking
tags: SMTP, Shell-Scripting, Email, Networks
content:
Setting up a mail server is a complex process. Beyond the technical challenge of configuring an SMTP server, many large companies take stringent measures to combat spam and potential security threats from unverified email domains.   
<br>
<br>The easiest approach is to use an established provider like Google or Microsoft, leveraging their existing infrastructure. Gmail and Outlook are excellent tools, especially for organizations utilizing Azure or Google Cloud Services.   
<br>
<br>However, I decided to take a different route—to test my skills and gain a deeper understanding of how email servers operate under the hood. Using a shell script, a virtual private server (VPS), and my own custom domain, I successfully set up my personal mail server.     
<br>
<br>
<br>
<br>Part 1: The Logistics  
<br>
<br>Setting up an email server requires configuring multiple components. First, I needed a dedicated domain and had to set up essential text records to verify my domain with major email providers. 
<br>
<br>Additionally, keeping the server secure and compliant with evolving security protocols is a constant challenge, but one that is rewarding to tackle.  Before I could begin, I had to contact my VPS provider, Vultr, to unblock SMTP ports on my account. These ports are often blocked by default for new accounts to prevent spam and phishing attacks. 
<br>
<br>Since I had been a Vultr customer for almost a year, they were cooperative and quickly lifted the restrictions. With SMTP access enabled, I was ready to move forward.     
<br>
<br>
<br>
<br>Part 2: A Little Help From Shell Scripting  
<br>
<br>To run a fully functional mail server, I needed four key components:    
<br>
<br>- Postfix for sending outgoing mail 
<br>
<br>- Dovecot for receiving incoming mail 
<br>
<br>- SpamAssassin for filtering spam 
<br>
<br>- OpenDKIM for email authentication    
<br>
<br>Postfix is an open-source Mail Transfer Agent (MTA) responsible for sending emails. If the goal was only to send emails without receiving them, Postfix alone would suffice.  To handle incoming mail, I needed Dovecot, which provides both IMAP (Internet Message Access Protocol) and POP3 (Post Office Protocol) support.    
<br>
<br> IMAP, used in services like Gmail and Outlook, keeps emails on the server, allowing users to access messages from multiple devices dynamically.   
<br>
<br>POP3 downloads emails to the client, making them available offline but less flexible for multi-device use.     
<br>
<br>The final and most critical component, OpenDKIM, was essential for authentication. It generates cryptographic signatures that verify my domain's legitimacy, ensuring my emails are trusted by providers like Gmail, Yahoo, and Outlook. Without proper authentication, emails risk being marked as spam or rejected entirely.    
<br>
<br>
<br>
<br> Part 3: The Script and the Server  
<br>
<br>Installing and securing these services manually is a tedious and error-prone process. Fortunately, I found a well-crafted shell script that streamlined the setup.  A shell script is essentially a series of automated commands executed sequentially. These scripts are widely used to simplify complex tasks, reducing manual input and minimizing errors. Running the script configured Postfix, Dovecot, SpamAssassin, and OpenDKIM, while also setting up the necessary domain records.  
<br>
<br>Once the script completed execution and I verified my domain records, my email server was live! I could now send and receive emails seamlessly across all major providers.    
<br>
<br>
<br>
<br>Part 4: Final Results:  
<br>
<br>Setting up my own mail server was a challenging yet rewarding experience. While using a managed email service would have been far easier, this project gave me valuable insights into the inner workings of email systems, authentication mechanisms, and network security.   
<br>The process reinforced the importance of proper configuration and ongoing maintenance. Moving forward, I plan to monitor logs, implement additional security measures, and explore further optimizations to keep my mail server running efficiently.


title: Solving Connectivity with a Raspberry Pi VPN Gateway
slug: solving-connectivity-with-a-raspberry-pi-vpn-gateway
images: ["Screenshot_2025-05-07_at_3.42.17_PM.png"]
category: Networking
tags: Raspberry Pi, WireGuard, DNS, Hardware
content:
When I configured my personal Linux VPS, I didn't expect to run into roadblocks so quickly. But sure enough, the Wi-Fi at my University started blocking my portfolio's IP address. This was due to a switch I made, from using `benjaminmosley.org`, to `benjaminmosley.com`. The campus servers had no context as to why I did this (just to make my site more professional) but in a zero-trust model, you have to assume everything unfamiliar is a threat.

As far as University IT staff know, the new domain could be part of a phishing campaign, botnet or otherwise. So, I was blocked. Not a huge issue, as I or anyone else looking to view my site could simply connect to another network to make the website load. The big problem this caused was with my coin counting device. Here's why:

The coin device collects data locally (in my dorm room) and when the data is ready, it gets sent across the internet to be received by `coins.benjaminmosley.com`. However, since the school's servers were blocking connections to that site, that means my coin counter's requests to publish data were all blocked too.

**This was a big problem.**

**So I built a solution.**

---

## The Idea: A Portable Gateway

Instead of accepting the reality that my device was bricked for as long as I lived on school property, I decided to build my own solution: a wireless access point that automatically routed through my personal VPN.

Right before this incident, I decided to test out **WireGuard VPN** on my other Linux VPS. This was mainly to create a private wide-area-network for accessing files stored locally from anywhere. However, my VPN would become the savior of my coin-counter.

---

## The Setup

I used a **Raspberry Pi** to build this access point. It worked like this:

- **`hostapd`**: This let the Pi broadcast a Wi-Fi network, effectively turning it into an access point.
- **`dnsmasq`**: A lightweight tool that handled DHCP (assigning IPs to devices that connected) and DNS (resolving domain names).
- **`dhcpcd`**: The daemon responsible for the Pi's own networking configuration — setting static IPs, managing interfaces, etc.

Then I routed all outbound traffic through WireGuard. Any device that joined my Pi's Wi-Fi would be automatically routed through my home network via the VPN — bypassing campus restrictions entirely.

Here's a simplified breakdown of what happens:

1. The Pi boots up.
2. It starts broadcasting a network called `PiVPN`.
3. A connected device (like my coin counter) gets an IP from `dnsmasq`.
4. All traffic from that device is tunneled through the WireGuard interface.
5. The traffic hits my home network (via VPN), where it's treated like any local device.

> No more firewall blocks. No more network tricks. Just clean, encrypted access.

---

## What I Learned — and What I'm Still Learning

This project taught me the fundamentals of **DHCP**, **routing**, and **interface management**. But I'll admit: I still want to dive deeper into how tools like `hostapd` and `dnsmasq` really tick. Why certain configs break things. How to debug IP conflicts. That kind of stuff.

I'm planning to write a follow-up deep dive on these services once I understand them better — so stay tuned if you're curious too.

---

## The Result

Now, I have a portable access point I can bring anywhere. It acts as a **VPN gateway-in-a-box**, giving me seamless access to my home server, DNS routes, and Samba shares.


