security? yes, please!


The Problem

Since last year, I´m hosting a FoundryVTT instance for our regular DnD sessions. In FoundryVTT you have the option to setup usernames and passwords for each member individual.

foundry_login

As I know my way around the IT world relatively well, I knew the passwords would be realtiv easy to guess, if the player have to choose them. So I set a website wide password with nginx and a .htpasswd file.

The Setup

Locate your nginx configuration file under /etc/nginx/sites-available/domain.com and add a new block for location /join

location /join {
    proxy_pass http://127.0.0.1:30000;

        #Defines the HTTP protocol version for proxying
        #by default it it set to 1.0.
        #For Websockets and keepalive connections you need to use the version 1.1
        proxy_http_version  1.1;

        #Sets conditions under which the response will not be taken from a cache.
        proxy_cache_bypass  $http_upgrade;

        #These header fields are required if your application is using Websockets
        proxy_set_header Upgrade $http_upgrade;

        #These header fields are required if your application is using Websockets
        proxy_set_header Connection "upgrade";

        #The $host variable in the following order of precedence contains:
        #hostname from the request line, or hostname from the Host request header field
        #or the server name matching a request.
        proxy_set_header Host $host;

        #Forwards the real visitor remote IP address to the proxied server
        proxy_set_header X-Real-IP $remote_addr;

        #A list containing the IP addresses of every server the client has been proxied through
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

        #When used inside an HTTPS server block, each HTTP response from the proxied server is rewritten to HTTPS.
        proxy_set_header X-Forwarded-Proto $scheme;

        #Defines the original host requested by the client.
        proxy_set_header X-Forwarded-Host $host;

        #Defines the original port requested by the client.
        proxy_set_header X-Forwarded-Port $server_port;

        ### CHANGE ME ###

        auth_basic           "Member Area";
        auth_basic_user_file /home/YOUR_USERNAME/foundryvtt_server/htpasswd/.htpasswd;

set the path under auth_basic_user_file /home/YOUR_USERNAME/foundryvtt_server/htpasswd/.htpasswd; to your own path. And generate a .htpasswd file with sudo htpasswd -c $HOME/foundryvtt_server/htpasswd/.htpasswd USERNAME where USERNAME can be anything you want. Make sure you generate the file in the exact location which is set in the nginx config file.

Restart nginx $ sudo systemctl restart nginx and open your website.

The Result
The website prompts you to authenticate

foundry_login2

The Troubleshooting
If you are getting an Error 500, or Error 403 you should check your nginx error.log
$ sudo tail -f /var/log/nginx/error.log

The most common errors are either permission denied, or nginx is unable to find the .htpasswd file. There are sereval option in fixing your errors:

$ sudo chmod 644 /home/USERNAME/foundryvtt_server/htpasswd/.htpasswd
$ sudo chmod 755 /home/USERNAME
$ sudo chmod 755 /home/USERNAME/foundryvtt_server
$ sudo chmod 755 /home/USERNAME/foundryvtt_server/htpasswd
$ sudo chown -R www-data:www-data /home/USERNAME/foundryvtt_server/htpasswd/.htpasswd

As a server admin you should know what those commands do, how to use them and which danger could come with type those into you CLI.

Enjoy your newly protected FoundyVTT instance.

Designing in photoshop is aweful.


Bill of Materials

  1. 3D Printer
  2. Black & White PLA/PETG
  3. Hairdryer
  4. Heat-shrinking clear pouches

Finished product

Icognito_7


Planning phase

There wasn't much planning. As you can see from the finished product. The print area could have been a bit larger. But anyway, I'm happy with the end result, and so is my brother - because it was his birthday present.


CAD

Originally I wanted to create a few selected Pokemon, but I realized very quickly that organic shapes are not my strength and I only saw one way to successfully complete my project - Unown.

CAD CAD2


Packaging

I printed a total of 120 Unown. 60 models and 60 TGC-ish cards. This meant that I had to print, cut out, glue, heatshrink and pack 60 packages.

Icognito_1 Icognito_2 Icognito_3 Icognito_4 Icognito_6

Im pretty happy with the end result, despite the small blemishes.

Finally replacing the removable bikelight and mounting a real light. + Update from "Bike Carrier v2"


Bill of Materials

  1. 1,5mm² Speakercable
  2. USB 2.0 port for soldering on breadboard
  3. breadboard
  4. shrinking tube
  5. male and female wire connectors
  6. soldering iron

Finished product

As it´s the unwritten law of the internet to show the finished product first, here it is:

Bikelight_15


Planning phase

The whole idea about this project is to use my bike battery to power the lights. I wrote the FISCHER support a long time ago with the inquiry if the sell lights that are compatible with my bike. Unfortunately they don´t.
As I have an USB port on my bikes controller, my plan was to buy some lights which intended use was receiving current from a dynamo. The problem with that? Bike dynamos generate 6V @ 3 watt. And my USB port generates 5V @ 1 amp. I got my bench powersupply and hooked up the lights with 5V @ 1 amp - and they worked!


Manufacturing

With this new knowledge, my plan was to chop up an old USB cable, clip the data cables and use the two remaining wires.

Bikelight_4

But the wires were way too thin to solder them, so I built my own USB cable with breadboard, 1.5mm² speaker cable an USB port and a soldering iron. Which worked on the first try.

Bikelight_1 Bikelight_2 Bikelight_3 Bikelight_6 Bikelight_7 Bikelight_8

As I have a 3D printer, a housing for the connector had to be made.
Not shown here: I filled in all the cavities with hot glue to protect the electronics from the weather.

USB_Shell_1 USB_Shell_2 Bikelight_10 Bikelight_11 Bikelight_14

Now that the difficult part was done, all that had to be done was printing the remaining mounts and wire everything to the bike.

FrontlightClamp BacklightClamp Bikelight_9 Bikelight_12 Bikelight_13


Update from Bike Carrier v2

After almost 2000 km there a no visible damages or deformation on the 3D printed PETG parts.

Manufacturing my own dice

Just showing off

dice_1

Text from top to bottom on each dice:

  • Volume
  • Melting point
  • Name of material
  • Weight
  • Density

Modifying my newly added carrier for my E-Bike


Problem

  1. Bike carrier wont fit with newly bought mudguards

Finished product

3D printed PETG adapter for my mudguard.

carrier_2


A few weeks ago I built a new carrier - which didn't really work. It would have worked if I hadn't decided to add mudguards to my bike. The mudguards didn't really fit on my 29" wheel and 6" tire, so I had to mount them in a way which deviated from the manual. Front wheel got the zip tie treatment and the back wheel mounting points had to be modified.
As a result my self built carrier mount had to be removed.

carrier_3 carrier_1

The OEM mudguard mounting was just a piece of straight plastic. But for my use case it had to be angled 90°. After 4 revisions on the 3D printer it finally fit. The black marks on the prototype are areas which had to be modified between each iteration.

carrier_9


carrier_4 carrier_5 carrier_8 carrier_6 carrier_7

The carrier mount was a whole different problem. As a test I printed a mount from PETG which only held for 200km on my bike. Because the overall design worked quite well, I decided that im going to rebuild it from 6061 T3 aluminium, which I had laying around.


Sadly I cant tell you about the longevity of the parts, because I had to RMA the controller. Maybe I'll remember to write an update once the replacement parts arrive.