Installing Chyrp-Lite, a lightweight micro blogging platform in OpenBSD 7.2

Written by Saïd

With an old-school internet spirit and its self-hosted, self-managed dinky websites, there is always a temptation to venture off the beaten tracks and popular products for blogging. Whether it is managed or self-hosted (WordPress, Blogger, Medium, Substack, etc.), popular stacks or CMS, or popular operating systems for bare-metal hosting (Debian, Ubuntu, Enterprise Linux-like, etc.), I've chosen to use a very niche blogging platform on a very niche operating system: Chyrp-Lite on OpenBSD.

It is always tricky when you use such niche products because it might require you to invest time into learning how to get it to work and to maintain it. It is understandable to wonder why spend so much time when you can use a managed solution or a popular stack that is easy to install and maintain. It depends on your goal: whether it is to spend more time learning how to install a website from scratch and how to maintain it, or spend more time being productive as a writer and delivering content. I am a terrible writer, so my goal was to create my own website using an uncommon blogging platform on a niche OS just as a hobby.

OpenBSD might not be the most efficient operating system, due to its "market share" and user base, and subsequently the support they can get from hardware/chips/software makers. However, it is widely recognized for its security, which is their main argument as they like to advertise: "Only two remote holes in the default install, in a heck of a long time!". Its solid TCP stack, low weight, and licensing make it more suitable for some edge cases.

Same goes for the hosting solution, I went with a small hosting company : OpenBSD.amsterdam. Other providers do offer OpenBSD as an option, others don’t but enable the use of custom images.

Required stack :

  • Web-server software
  • PHP with default extensions (Session, JSON, Ctype, libxml, SimpleXML)
  • PDO to enable PHP to access our database
  • MySQL 4.1+ or SQLite 3+ or PostgreSQL 10+

The VM :

The version we will be using is OpenBSD 7.2-release. The process to book the VM at OpenBSD.amsterdam is the most human-friendly I've ever experienced. After filling the necessary information on the website (SSH public key, RAM and HDD size, ...) I quickly got a friendly email from Mischa that shared my VM details on the spot, knowing that I did not pay yet and I was able to connect and test it. Upon connecting I recovered and changed the root password as explained here. I then disabled root SSH logging and password login for the user account and enforced the use of SSH public key authentication in the sshd configuration file /etc/ssh/sshd_config :

PermitRootLogin no
PubkeyAuthentication yes
PasswordAuthentication no

After updating/upgrading the host, install the web server :

openbsdhost# syspatch
openbsdhost# pkg_add -u

The web server :

OpenBSD comes with a web-server out of the box, httpd. I struggled with configuration files and I was not sure I would be able to get it to work with PHP. I went with the industry standard Nginx :

openbsdhost# pkg_add nginx
openbsdhost# rcctl enable nginx
openbsdhost# rcctl start nginx

Edit the nginx configuration files /etc/nginx/nginx.conf to add index.php to the index option in http section :

index         index.html index.htm index.php;

Also to nginx.conf, add the following to the “server” section so the PHP pages can be interpreted :

location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass   unix:run/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}

And last, test the nginx conf :

openbsdhost# nginx -t

If you got an output that the syntax is ok, you can move to the next section.

Installing PHP

install php 8.0.26 and its required modules as follows :

openbsdhost# pkg_add php php-gd php-intl php-xmlrpc

Enable and start PHP-FPM, the FastCGI Process Manager :

openbsd-host# rcctl enable php80_fpm
openbsd-host# rcctl start php80_fpm

Install the modules that will enable PHP to connect to MySQL:

openbsdhost# pkg_add php-mysqli php-pdo_mysql

Copy the configuration sample to the main PHP folder :

openbsdhost# cp /etc/php-8.0.sample/* /etc/php-8.0

Create a php test file in /var/www/hdtocs/test.php containing the code below and try accessing it using your http://server-public-ip/test.php, this might require rebooting your server/services to work :

<?php
phpinfo();
?>

If you are getting the phpinfo output on your web browser, then PHP is working as expected. You may delete the test.php file and move on.

Installing and configuring MySQL :

Install, initialize, enable, and start MariaDB server. I used MariaDB 10.9.3(MySQL 15.1) :

openbsdhost# pkg_add mariadb-server
openbsdhost# mysql_install_db
openbsdhost# rcctl enable mysqld
openbsdhost# rcctl start mysqld

Proceed to the secure installation :

openbsdhost# mysql_secure_installation

To configure MariaDB for Chyrp-Lite we need to connect to it and create the database and the user for it :

openbsdhost# mysql -u root
MariaDB >CREATE USER 'chyrpdbuser'@'localhost' IDENTIFIED BY 'password';
MariaDB >CREATE DATABASE chyrpdb;
MariaDB >GRANT ALL PRIVILEGES ON chyrpdb.* TO 'username'@'chyrpdbuser';
MariaDB >FLUSH PRIVILEGES;

Now our stack is ready to receive Chyrp-Lite.

Installing Chyrp-Lite :

Dowload the latest release of Chyrp-Lite at https://github.com/xenocrat/chyrp-lite/releases/

openbsdhost# wget https://github.com/xenocrat/chyrp-lite/archive/refs/tags/v2022.03.01.tar.gz
openbsdhost# tar -zxf v2022.03.01.tar.gz
openbsdhost# cd chyrp-lite-2022.03.01/
openbsdhost# mv * /var/www/htdocs/

Delete the “tools” folder and start installing Chyrp-Lite by visiting install.php at http://server-public-ip/install.php

The web page will ask you to adjust some folder permissions, you can do so and reload the webpage until you have no more permissions to adjust :

openbsdhost# chown www /var/www/htdocs/includes/

image

Depending your configuration, all optional fields can be ignored :

  • Adapter : should already be selected to MySQL.
  • Host : should have “localhost” by default. But I ran into issues that were resolved by setting to “127.0.0.1” instead.
  • Username: Chypr-Lite user that we created in MariaDB.
  • Password : password for the Chypr-Lite user in MariaDB.
  • Database : Chypr-Lite database that we created.
  • Chyrp URL : you can set your public IP or your domain name if you have one. We will not be covering anything related to setting your domain, enabling https etc. If you are setting a domain name you would need to redirect all type A DNS records to your web server’s public IP, this can be done in your registrar dashboard.

Admin account user name, password and email : this will be the user that you can use to log and manage your Chypr-Lite blog.

Upon submitting you will get a webpage confirming that the installation is completed and that you can delete the install.php file. After deleting that file you may log and start using your blog.

Recommended :

I recommend every once in a while to backup your "Upload" folder, the /include/config.json.php file and to save a dump of the Chypr-Lite MariaDB database in case your server crashes, if you want to move your web server to another VPS provider or update Chyrp-Lite.

Errata/Feedbacks can be sent to : said [at] nexoft [dot] fr

How to find available & short domain names with any extension

Written by Saïd

I found this script while cleaning my folders, a very efficient way to find available three-letters domains with any extension, I thought I would be interesting to share it. I'm not the author of this script - I found it on HN a while back and I am unable to find the original post. The way it works is that is it automates the name server lookup command for the the domains using the nslookup tool and return those for which it gets an NXDOMAIN error (Non-existent Internet Domain Name).

Create a .sh file "domainsearch" by copying/pasting the following into your terminal in linux:

cat > domainsearch.sh << "EOF"	
#!/usr/bin/env bash
array=( a b c d e f g h i j k l m n o p q r s t u v w x y z )
for a in "${array[@]}"
do
	for b in "${array[@]}"
	do
		for c in "${array[@]}"
		do
			domain="$a$b$c.eu" #change the domain extension to fit your search
			echo $domain
			nslookup $domain|grep NXDOMAIN >> availabledomain.txt
		done
	done
done
EOF

Edit the script to fit your needs by adding more "do" loops and more variables in "domain" to find more than three-letters domains or change the extension or a different one.

Start the script :

bash domainsearch.sh

The example above is looking for available three-letters domains with a .eu extension. This will create and update "availabledomain.txt" listing available domains in the current folder.

Deep House Mini-mix (2009 repost)

Written by Saïd

This is a mix I made back in 2009, 13 years ago! I posted it on my back-then blog which I then forgot about (it was pretty much the only post). PHP / Wordpress versions on that blog are so old it made it crippled with vulnerabilities and the comment section got flooded by bots. I got access to it to close the comment section and I tried to update the thing but I then gave up, I wasn't able to figure out an easy way to update it while keeping the content. For the story, I got that space even before, near 2004. I was actively participating in a music website/forum called Universdj that was run by Dj TuXxL with the help of some house music heads. House music fans were sharing their mixes on the website. It was a challenge back then to share anything for free when there was no Soundcloud and MP3 sharing in personal websites was closely monitored by ISPs in France, afraid to get sued by Major record labels : my personal website hosted at Orange got closed multiple times and I had to reach out to them to get it reopened. I went to Free which had a more "open" policy regarding that kind of sharing. I'm no longer a Free customer but it amaze me that the website is still up ... for Free. The mix reflect the kind of music I was listening to back then, pretty heterogeneous, from Deep Techno to Detroit House and some Disco and Deep House Music. Good listening!

taken from ffffound in 2009, unknown author

Download

Track list :

  • Trus Me – At The Disco
  • Moodymann – Mahogany Brown
  • Chicago Skyway – Bells
  • STL – Moonlight Reflections
  • Motor City Drum Ensemble – Raw Cut 4
  • Moodymann – Hello 2morrow
  • Larry Heard – The Sun Can’t Compare
  • Loco Dice – Tight Laces (Marcel Dettmanns Response 2)
  • Luke Hess – Shalom Dub
  • Directions – Busted Trees (C’s Spacetrumentrumental)
  • Moody – During Soundcheck
  • Craig Alexander – Groove Mission (Luv Dub)
  • Soundstream – Dance With Me
  • 6th Burough Project – Planets
  • Dj Harvey – Disco Adventure