discord.jse.io" itemprop="description"/>

Jonah's Blog

Jonah's blog is here

Lighttpd in Ubuntu repos does not start

- Posted in Linux by with comments

Clean install of Ubuntu 17.10. Wanted to work with lighttpd. Could not get lighttpd to start? What gives? It seems to return this error: undefined symbol: FAMNoExists

So the solution posted here is to install the package gamin with apt. Should be a dependency.

Why is this an issue? I don't know, but hopefully 18.04 doesn't have this issue down the road ;)

See this bug here.

So mempler (join our discord server if you don't know him!) is working on a currently undisclosed project on one of my servers and wanted to do some rewriting to a php file.

I never have done much with rewrites ever with anything. I never really cared about ugly URLs anyway with anything I ran in PHP so I just didn't care. On the occasion I needed to run something that did, someone always provided it to me in a .htaccess with it, but I want to use lighttpd. It's just more efficient for what we want. Fight me.

Anyway he wanted something like example.com/path/here to rewrite to example.com/index.php?path=WhateverCameAfterSlashHere as long as no ? appears in the URL (more on that later).

So that is pretty easy. Just do something like "([^?]*)" => "index.php?path=$1"

So what does this do? Well. I used this place and the lighttpd documentation to figure this out. Basically, a * will match anything. Quoting autohotkey.com:

An asterisk matches zero or more of the preceding character, class, or subpattern. For example, a* matches ab and aaab. It also matches at the very beginning of any string that contains no "a" at all.

Anything in the parentheses are a regex group for lighttpd, so anything it matches is provided to $1. Quoting the lighttpd documentation:

If the matched regex contains groups in parentheses, $1..$9 in the replacement refer to the captured text in the matching group "$1" meaning the first group, "$2" the second, and so on.

More on that later when we want to have a second group.

I also wanted it to stop at a ?, which eventually will be used to look like you're really accessing an index.php on the path in the URL and you're going to specify the first parameter that of course is passed to $_GET, even though the path is one too but unsuspecting people won't know that.

With the [^?] before the * we're telling regex to match everything EXCEPT for a ?.

Again, to quote autohotkey.com:

Matches any single character that is not in the class. For example, [^/]* matches zero or more occurrences of any character that is not a forward-slash, such as http://. Similarly, [^0-9xyz] matches any single character that isn't a digit and isn't the letter x, y, or z.

Now we also want to handle other parameters. This is where our second group comes in. Of course, we already included the ? for the path parameter in the rewrite rule where $1 is passed. When people supply a ? it should actually be after an & and the ? shouldn't actually be passed to the requested php file. I did this:

url.rewrite = (
                "([^?|&]*)\?(.*)" => "index.php?path=$1&$2"
        )

As you see, since the ? in regex actually means something (A question mark matches zero or one of the preceding character[...]) I need to escape it with a backslash which isn't a foreign concept to anyone who has dabbled in scripting and programming even a little bit. So this means expect an actual ? character in the URL and then I made a second group that will match *literally *everything with the .*. That's fine though, he can handle it in the PHP code for whatever he wants to do. This means that any other parameters in the URL will be followed with an actual & character in the URL and not something else of course, but that's fine, nothing for lighttpd to handle.

You'll also notice that in my first group where I told it to not match a ? that I specified a | (which means OR, also not a foreign concept for most) followed by an & symbol, so people can't specify additional parameters after an & sign before the ?.

This means we're now resulted with: url.rewrite = ( "([^?|&]*)\?(.*)" => "index.php?path=$1&$2" )

Now the problem is that sometimes he doesn't want to specify other parameters after the ? in the URL, but if you try the rewrite example I provided you'll notice if no ? character is specified in the URL you get a 404 thrown at you as the rule has no match.

I initially then decided to do

url.rewrite = (
                "([^?|&]*)" => "index.php?path=$1"
                "([^?|&]*)\?(.*)" => "index.php?path=$1&$2"
  )

Now as you might expect if you're not retarded like me that won't work. Now parameters are never provided to the PHP file when they are in the URL because the first rule I specified always applies (and of course, doesn't match anything with a? character or an & character)!

The fix is simple. Just reverse them like so:

url.rewrite = (
                "([^?|&]*)\?(.*)" => "index.php?path=$1&$2",
                "([^?|&]*)" => "index.php?path=$1"
)

This way if a ? exists in the URL then of course, the first rewrite rule applies since it's the first that appears. Otherwise, the second will.

That's for going along with me on my regex learning journey. I know this is probably simple for most people but took me a while to figure out as I've never done it before (aside from fixing my htmly rewrites for lighttpd a while ago which doesn't count!)

Moving

- Posted in Web/Technology by with comments

So the server this blog is hosted on is bad.

I mean, I love the thought of a low end box and never have I pushed it to it's fullest potential, but I frequently get emails from statuscake telling me it's down, yet again. It seems to be network, the vm doesn't actually go down, but whatever. I'll say more about that another time.

Anyway, I am moving this site to a Kimsufi dedicated server in time. It's an i3-2130 for $12.99/mo on flash sale. Not an amazing "server" but the price is nice.

I'll still keep this LEB, it will probably host a mirror for stuff and backups, but nothing I will really care much about beyond that.

Perhaps I'll write a more in depth review about it all later.

Anyway since I scooped up a couple of these I'm going to move everything and mirror the data across them, along with publishing some downloads to the BuyVM anycast "CDN" I have so there will be a lot of redundancy when I'm done for everything.

UPDATE: 3:30AM on the 20th and I'm going to bed. https://jseb.ca is moved though (which probably doesn't mean much as it's mostly a screenshot server I use with sharex aside from mirroring some other files, but it had a lot of files (including the recovery bins, some images on this blog and one of the drivers for blackweb), and I'm slow as I talked a lot on discord in between, but it's moved.

Tomorrow is a busy day but perhaps in the evening I'll move some other stuff then actually get onto moving this website. Meanwhile mempler.de has been working on something with all that storage I've gotten my hands onto ;) Hopefully I can also write more about that as time goes on and get more involved into it (and learn more about node.js!!)

Oh yeah.... it's also an opportunity for me to move 100% of my stuff to HTTPS with HSTS. So there's that. Say goodbye to port 80.

Update 2 Nov 21 also early in the morning:

Moved jsebean.com (this site over). Should have been seamless since I'm not hosting any dynamic content here. Just a quick DNS change.

So Kong from the DD-WRT forums used to provide builds for DD-WRT that I used for my MVEBU Linksys 1900acv2 router. He apparently doesn't anymore, which is fine, brainslayer builds are fine for me, but I wanted to keep the bins he had uploaded for reverting to stock.

I figured I'd post them here in case someone else is looking.

While you shouldn't need these for your 1900ac router if you followed the "FAQ" thread response I wrote, there may come a time you do need it. I tested it before on my acv2 from Kong but I actually got these from a different mirror (since kong deleted them) so they are not tested. I may test them someday. Until then, use at your own risk.

This is a single zip archive with all of the factory firmwares for 1200ac, 1900acv2 and 1900acs, which in theory the acs one should also work with the 1900acv2. Sorry, I don't have them for any other router, but you can check out this thread for details if yours isn't listed here which I can confirm works for the later 3200acm unlike testing these which I haven't done yet. Been busy working but perhaps someday I will. If you can comment below your results though that would be appreciated!

Of course.... if you completely brick your router, you can always go the route of a usb-to-ttl cable.

Anyhow, here is the download link.

UPDATE August 10th, 2017 Much thanks to Jared Trotter for submitting the Blackweb BWA17 drivers. Download links updated below.

UPDATE June 11, 2017

This should help clarify things for people who have issues with this driver for their mouse and perhaps could help solve future issues for people down the road if they want to contribute to hosting their mouse driver.

While I initially thought there was only one model of a Blackweb gaming mouse it's been brought to my attention though comments (here and on youtube), discord, and emails that people can't get this to work. Apparently Walmart has several models (figures) of this mouse and some (if not all of them lol) use a different drive. Additionally, turns out the particular gaming mouse my brother got was one like this, not the older BWG66 model, so I cannot say if the BWG66 will work or not with this driver.

Anyhow if you have a different model and this driver does not work, but you have the ability to upload the particular driver for your model from the CD you got, along with a link or description (or a walmart store link) of the particular model you have please email it to me at [email protected] and we can talk about hosting it here for others with a similar model (if you're trustworthy of course ;) ) Screenshot of the walmart store link I provided above if they decide to remove it down the road: https://jseb.ca/blackwebmousepage.png

The one we have essentially has two buttons on the side in addition to the standard mouse buttons along with a "DPI" button that also changes colours with the mouse DPI. It has a black top, all one piece on the top (unlike the pictures I saw in the original BWG66 post I linked).

So I hate optical drives, and in both the PC I built for myself and the one my brother uses doesn't even have one inside it. Seriously, I want optical discs to just die.

But recently for my brothers birthday he got a "Blackweb Gaming Mouse", it has 5 buttons not counting the DPI button and is supposedly RGB, which changes colour when you change the DPI if the driver is not installed and configured otherwise. It was purchased at Walmart. A CD came with the mouse, supposedly with the driver/utility, but generally we just head online to find the driver and download it from there.

Well not this time. People have asked on Reddit, and YouTube, and on Walmart.ca itself, nobody knowing an answer on where to get the drivers for Blackweb.

So I'm not sure if they just didn't get the CD, they just refuse to insert one into their PC, or they don't have an optical drive, but I took the time to fetch the setup file (It's literally the only file on the CD) and upload it here. It's only ~5MB, and to be honest it's way more clunky than Logitech/corsair software I've used, but it gets the job done. It definitely does have "cheap" written all over it but hey... if it works, at least you got the full functionality that was advertised on the box.

The driver lets you change the colour profiles, change button functions (including changing the function of the "DPI" button) and DPI itself from a graphical interface among other things.

If you have this mouse... then look no further than here. EDIT: Additionally, I have provided a download link for other Blackweb models (namely, BWA17 at least). If you have drivers to submit if your model is not supported, please email them to me ([email protected]) to share here.

Download links:

Click here (Blackweb Gaming Mouse Driver 5 button + DPI button)

Click here (Blackweb RGB Gaming Mouse BWA17 Driver) (Thanks to Jared Trotter for submitting this!)

Screenshot: screenshot screenshotbwa17

If any nerds out there want to mirror this that would be great just so I don't lose it down the road if I decide to make server changes, but hopefully I won't ;)

In addition, this reverse engineered python utility is available for the Blackweb AYA(?) mouse (looks similar to the mouse my brother has?) for linux! If you're using debian/ubuntu run sudo apt install python2.4 python-qt4 pyusb and then run sudo ./ayatool_qt.py (remember to chmod it!) to launch the graphical configuration tool (have not tested so if you need help post back especially if I'm wrong about dependencies!). If you can install all that stuff on a Mac it should also work for Mac users. Kudos to commenter Jigoku for writing this!

Screenshot: linux blackweb utility

Just posting this quickly (excuse any typos or brainfarts, going for dinner soon ;) ) to say ExtraVM goes above and beyond to be awesome. Been using them to host a teamspeak server since last August (2016). We decided to get a dedicated server for ECMB since you need a good chunk of memory to start an Ark server, even though we're small (only ~50 members on discord last I checked eg).

Kimsufi has great deals on dedicated servers. I got my hands on one with an i5-3570S.

[email protected]:~$ cat /proc/cpuinfo
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 58
model name      : Intel(R) Core(TM) i5-3570S CPU @ 3.10GHz

Sure, it's not great, but handles Ark server perfectly for us and should be able to run a couple CSGO and Minecraft servers too. If it grows to the point we start getting lag, then of course we'll move things around and upgrade to a better server (from SYS or OVH directly eg).

However one of the issues we experiences in the past is the dreaded DDoS of script kiddies getting a kick of null routing me drawn in from the teamspeak server. We publicly list teamspeak as this is one of the ways we've found some cool people, but it seems to draw in the "cancer" too from time to time. To protect it, I've been a fan of ExtraVM after it being recommended on forums like r4p3.net.

It is great, but there comes a point that Kimsufi is still more affordable for certain projects, aside from not having the DDoS Game protection OVH seems to famously (or infamously when it doesn't work) offer.

Luckily, the awesome Mike A who owns ExtraVM goes above and beyond and gave me, at no extra cost a free IP I can use to setup a GRE Tunnel to the Kimsufi. I opened a ticket asking ExtraVM and he's quick to respond as always... unlike pretty much any other host I've been with (SYS was notoriously slow to respond to tickets eg). He did say that despite GRE kernel module existing on all nodes, some people have trouble setting up GRE tunnels on his VPSes (suggestion others have tried and he has no issue with it) so my milage may vary. Only took a couple minutes and it worked without any issues! WOOT!

Given that ExtraVM's OpenVZ plans are hosted by OVH just like Kimsufi the pings are ~0.5ms, so it's not noticeable to any players. Even if I have to buy an extra TB or so of bandwidth it's still cheaper than buying SYS/OVH Game servers, and if we grow the point that I end up using too much bandwidth hopefully by then we'll be able to easily upgrade to a real game server anyway.

Anyhow, just thought I'd give a shout out to ExtraVM as it's an awesome company for anyone looking for an OVH reseller. I've seen some people criticize r4p3.net's reputation on zero day exploits, and I'll hold out my opinion on that too, but they do know their stuff when picking a good affordable host :) There's been a lot of hit and run hosts that resell OVH but it seems ExtraVM certainly is the exception as I've had no issues with them.

I don't play Ark or know anything about it, but with ECMB, people want game servers, and I'm their guy. I am running a dedicated server at OVH with Ubuntu 16.04. My brother "asabean" is the one who decided what config settings the ARK server should have, and he happily applied the variables in Game.ini and GameUserSettings.ini. He essentially just copied from his local save in Windows and pasted in the parameters into the file in the text editor in putty. Yes, it was nano. ;)

I'm a fan of the scripts from gameservermanagers.com, which is what I used to install Ark. It's very easy and way better than doing it manually through streamcmd as I quickly learned with running CSGO servers. It's nice to be able to just type ./arkserver install and ./arkserver update and not having to think about 'did I set force_install_dir correctly'? Heck... it's annoying when you think ~ will work with force_install_dir (normally meaning home for those who don't know) but instead it actually makes a directory named ~. Been there, done that, so anyway...

Getting mods to work was a challenge. It seems quickly googling how to do it isn't that easy with Ark Servers as there's a ton of misinformation out there, however Ark is supposed to download and run them pretty much automatically now I guess. Initially we uploaded the mod files from the Mods folder on Windows, and adding ActiveMods= in GameUserSettings.ini. (FWIW these files are located in ~/serverfiles/ShooterGame/Saved/Config/LinuxServer That didn't work.

Then I decided to add

[ModInstaller]
ModIDS=

to Game.ini and tried to start the server with LGSM. It failed. Checking logs showed some sort of segfault crash.

Huh... progress, but still not working.

Googling around led me to this thread on the steam forums. User "TheKurrgan" explained that the automodinstaller or whatever it's called in Ark depends on SteamCMD that doesn't exist in the proper location (turns out, seperate from the steamcmd you used/lgsm used to install it), and so you need to add it yourself. To do so, in your serverfiles/ directory, navigate to Engine/Binaries/ThirdParty/SteamCMD. Then, make a new folder called Linux with mkdir Linux and then cd Linux. They then proceeded to download steamcmd with curl using curl http://media.steampowered.com/installer/steamcmd_linux.tar.gz > steamcmd.tar.gz (of course you can use wget or something else similarly if you don't have curl installed), extract it with tar -zxf steamcmd.tar.gz and execute ./steamcmd.sh.

SteamCMD will then update and whatnot, and when you finally get the Steam> prompt, just type exit and start your server.

It worked!

Now FWIW, I read elsewhere you need to have the mods in GameUserSettings.ini and keep them in order, so I kept just copied the same order from the desktop. How true or important this is was beyond me, I just took their word for it. The particular mods we used looked like this in the end:

ActiveMods=764326117,774762563,627340159,554678442

and in Game.ini

[ModInstaller]
ModIDS=764326117
ModIDS=774762563
ModIDS=627340159
ModIDS=554678442

Once I started the server with LGSM it downloaded the mods and all is well. Now onto figuring out admin commands and whatnot....

Anyway, that's what I learned doing this so far so anybody else who gets stuck on getting mods to work on a linux server, hopefully this helps!

So you logged in as root/user with sudo permissions... ok? You want to be at least 20% secure though, and the next coolest game server shouldn't be ran as root. You're just not as dank as Bryan Lunduke.

Perhaps it's Minecraft you want to setup, and you're going to use GNU Screen for running it in the background like a bajillion of online tutorials suggest.

You add a user for minecraft, but hey! Let's be a little bit secure and you use SSH Keys and don't want to be bothered to setup a key for your new minecraft user. OR when you run adduser minecraft you also add the flag --disabled-password or you used the good ol' useradd and didn't set a password because life goals or something.

Whatever the reason is, you don't want to be bothered with firing up another putty window just to run screen, you just want to su to the new user and do your magic.

Now you can always just run screen -dmS sessionname your command here and it will run the command specified after the session name. Assuming you didn't screw up, it'll work fine.

But what if you don't want --dmS? What if you want to attach to the screen session? Whether you're using screen -r or just starting a new session the classic way with screen -S, it doesn't work, all because you su'd in. Screen can't control your pseudo-terminal because you're really using the one from the user you su'd from yet you're running screen from the su'd user. It cries out in agony! Cannot open your terminal '/dev/pts/0' - please check. But alas.... just run this command first:

script /dev/null

Then run your screen session.

Just remember to type exit when you're all done to end "writing" the script.

It'll work. You're welcome.

TL;DR: If you just want the rewrite rules for Lighttpd, scroll to the bottom code snippet.

So like most every other PHP app I've worked with, everybody seems to support both apache and nginx but poor old lighttpd gets left out in the cold and has no support on how to configure it in documentation.

Well have no fear, because you'll have to pry lighttpd out of my cold dead hands!

A while back I setup a VHOST for jseb.ca on Lighttpd with an FTP server so I could integrate it with Sharex. One other feature sharex seems to support is "short URLs" using an API from a PHP script called YOURLS. So I wanted to install it on my low end box.

Now if you caught on earlier, this blog is hosted using a flat-file database platform called htmly, because my lowendbox with only 128MB RAM isn't really ideal for running something like wordpress. MySQL can sure eat the RAM, so I sort of decided to not use MySQL on this server at all.

SQLite on the other hand is a perfect candidate. While it locks the entire database when you're writing to it, something like a URL shortener is a perfect application, since it's pretty much read only. Only time it writes is when I decide to add a URL, which is a fast query and so few and far between, it's a way better candidate for a personal URL shortener over MySQL for a site my size anyway.

Unfortunately, YOURLS doesn't support SQLite out of the box. Luckily there's a great project here on github that adds it. Sweet! That was easy! Install php5-sqlite on my Debian install, chown/chmod your stuff so PHP can write to the directory YOURLS is in, install it by going to /admin/ and we're all set.

However, first thing you'll notice if you're running lighttpd is you'll get 404s since lighttpd doesn't support .htaccess, which YOURLS generates when you first install it. A search around on the internet will find stuff like this, but all the snippets in the examples causes issues for me.

While the last post from gsdefender (from Apr 24, 2016) works, my index.html on jseb.ca doesn't! Now I know it's not special, but it triggered me that if you visit the root, rather than showing my index.html it resulted in a redirect loop which freaked out Chrome.

Now like you probably figured out by now if you read anything here, I'm not much of a sysadmin or programmer, but I know my way around enough to be dangerous. I never got my head around regex stuff, but a quick look at lighttpd documentation says the ?

match zero or one of the previous symbol

Previous being keyword here... I just removed it.

So, now, with a vhost setup and mod_rewrite enabled for lighttpd, my lighttpd.conf looks like this for jseb.ca:

$HTTP["host"] == "jseb.ca" {
    server.document-root = "/var/www/upload/"
    url.rewrite-once = (
#        "^/([0-9A-Za-z-]+)?$" => "/yourls-go.php?id=$1",
#        "^/([0-9A-Za-z-]+)?\+$" => "/yourls-infos.php?id=$1",

        "^/([0-9A-Za-z-]+)$" => "/yourls-go.php?id=$1",
        "([0-9A-Za-z-]+)\+$" => "/yourls-infos.php?id=$1",
)

As you can see, the original copy-pasta from the github issue is commented out so you can note the difference between the two. It works for me... now my uploads and shorturls both reside on jseb.ca and coexists pefectly along with an index.html. So hopefully this helps anybody else who wants to run YOURLS on lighttpd.

Why did they put the ? to begin with? I don't know? Perhaps you can tell me? enter image description here

169pp... need moar pp... to Tillerino I go...