Wednesday, 15 November 2023

CobaltCMS v0.1

 So, if you've happened to find this blog, you may be wondering "why?"

Yep, good question.

So I would respond "because.."

(sorry, Mum, I know it ain't proper grammar!)


In all seriousness though, there is somewhat of an agenda here.

It's now 2023, about a quarter century since these Cobalt Microserver machines were made, and a lot has changed - not all of it for the better. However, I don't want to get massively sidelined by the discussion about of forced obsolescence, or the enshitification of everything.

What I'm referring to is the way that everything has become over-engineered. Cars have become SUVs, pickup trucks have become behemoths, and computers have become... well... they have become "The Cloud (tm)"

Nowadays everybody is trying to build their computing infrastructure as though they are The-Next-Netflix (tm). Raise your hands if you have built or used at least one Kubernetes cluster in prod!



But where did all this over-engineered complexity come from? Why does it feel like overkill in most situations, when all you want is a simple website or API?


This is our effort to bring back a concept of simple computing, to bring back the ideals and aspirations we perceived to have been held of visionaries such as Alan Kay, or Steve Jobs and Steve Wozniak when they founded Apple "to democratise computing", and more recently the founders of the Raspberry Pi foundation.

Here's another example, about more sustainable forms of computing: https://solar.lowtechmagazine.com/

Now, what the heck has any of this got to do with a CMS you say?

If your Cobalt Qube 3 is still alive and running, you may find it has extreme difficulty working in a modern browser. At least, the admin panel of it will throw white screens, unless you happen to have an old machine running Windows XP and Internet Explorer for example, or maybe Netscape Communicator if you are feeling a bit extravagant.

Now, there's good reasons why things have advanced since 1999 on the Internet, not least of which is security.

However, what I would like to show is how a machine from 2000-2003 can still be used today, despite it's inherent limitations.

I would heavily caveat this blog with "Don't try this at home" style warnings, but in this case, I would say please do try this at home... just don't put your machine directly onto the internet without proper protections in place, or you will be promptly hacked! Remember kids - always practice safe hex!

With that out of the way, what was the Cobalt Qube meant for originally, and what can we still do with it?


Alrighty. well, for this post I'm going to concentrate on the Qube 3, since I have one running with the Cobalt OS 6.4. Designated as the 4000WG, where the WG stands for WorkGroup - this was a Server Appliance meant to be purchased by a business to be used in office as an all-in-one solution for serving web, email, DNS, ftp, Windows/Apple filesharing as well as a few other functions.

I chose this model in particular because early revisions of the Cobalt product line did not fully utilise the "Sausalito" configuration engine, which was based on an Object Oriented PHP approach. So this machine has Apache HTTPD, PHP 4.0.4 and MySQL 3.23 (if memory serves) - just enough to be a little LAMP server, the old nickname for Linux, Apache, MySQL and PHP.

btw - This entire OS and even the ROM for the machines was released as Open Source Software when Sun acquired Cobalt Networks btw - and we may explore that in later posts.

Now, theres a few things I want to implement immediately. The rest are going to be left as an exercise for the reader / community.

  • I want to have a default page that shows if no Posts exist.
  • I want to have an admin page where I can create Posts
  • I want the homepage to display the most recently added top three posts

I know this is far from a complete CMS as such, and one normally wouldn't write your own when off the shelf solutions exist, but in this case, we are talking about PHP 4.0.4. Although it supports Object Oriented coding, there are still many features that were not yet present in the language at the time - for example you did not get SuperGlobals such as $_GET and $_POST for handling form submissions until around version 4.3.x

There's no security either. The admin page is accessible by simply adding a GET parameter to the query string - and in this version of PHP there is not even a mysql_real_escape_string() function - making such a  form/website very vulnerable to SQL injection attacks.

I don't plan to address this, and if you choose to implement this yourself YOU HAVE BEEN WARNED!!

However, it works just enough that you might see fit to adapt it to your own purposes - for example, it might make a great guestbook script with a little modification / protections added.

So, how will it be implemented?

First we need to login to the box, on a fresh install go to the IP address you set via the LCD input using `telnet x.x.x.x` where x.x.x.x is your IP, and login with creds admin:admin - unless you have already changed it, which you should!

(tip: You may need to become root with the `su` command in order to complete some or all of the steps below)

The front end will be called content.php, this will go into /home/groups/home/web/ as content.php

style.css is added to give some basic spacing and colours, and construct2.gif is just a little decoration for the homepage when there is no content. both of these files need to be added into the same folder where the content.php page is - /home/groups/home/web/

The CobaltCMS class itself will be implemented in CobaltCMS.php, and this will need to be added under /usr/sausalito/ui/libPHP/ as CobaltCMS.php. This is so that it can be found by PHP when it scans the 'include_path' to locate the file which we will specify in our content.php page.

Now, that's the script side of things. However a couple more steps are needed before we can successfully launch our site - we need to allow apache https to load the mysql.so file so that PHP can communicate with the database.

as root, we need to edit /etc/httpd/php.ini and remove the semicolon from the beginning of the line so that we end up with `extension=mysql.so`. Save and quit (if using vim to edit that's `:wq`) and then restart the Apache server

/etc/rc.d/init.d/httpd restart

Shutting down Web Service: httpd

Setting up Web Service: httpd

now navigate in your browser to http://x.x.x.x/content.php and hopefully you will see something like this!






You can grab the files from 

https://sourceforge.net/p/cobaltqube-cobaltcms/code/ci/v0.1/tree/

Happy Hacking! :)

No comments:

Post a Comment

New Product Announcement

Welp, it's been over 20 years since Cobalt Microsystems / Sun Cobalt shuttered up, and so obviously there have been no new products on...