simple web server that integrates with DuckDNS & Let's Encrypt
simple web server that integrates with DuckDNS & Let's Encrypt
Upduck is a simple HTTP and HTTPS static file server that integrates with DuckDNS. It is meant for quickly sharing static files beyond your local network over an HTTPS connection but can also be used within your local network (without HTTPS).
Disclaimer: This project has no affiliation with DuckDNS or Let's Encrypt and is not endorsed or supported by them.
Disclaimer: Using this program with the -email flag signifies your acceptance to the Let's Encrypt's Subscriber Agreement and/or Terms of Service.
The help section of the program tries to be as helpful as possible, make sure you read the section with examples:
…You can either compile this program or download a release.
You can download a version for your system and move it anywhere you want. It is recommended to put the executable in a directory from your $PATH.
On a Raspberry Pi the following command should download the right executable:
arch=$(uname -m) && wget -O upduck "https://github.com/xarantolus/upduck/releases/latest/download/upduck-raspberrypi-${arch%l}"Mark it as executable:
chmod +x upduckThen move it to your $PATH to make it accessible everywhere:
mv upduck /usr/bin/upduckNow you should be able to run upduck from anywhere. This is especially useful if you set -dir . while saving settings, as now it always serves directory you're currently in.
If you want to use ports below 1024 and run upduck without root (sudo), you can set the CAP_NET_BIND_SERVICE permission:
setcap 'cap_net_bind_service=+ep' /usr/bin/upduckSince this is a normal Go program, compiling works like this:
go buildIf you're compiling for another operating system, you can set environment variables. You can see the release.sh script to see how it's done for building releases.
You can also run upduck on Android (using Termux).
You'll likely need root though. I tested this on my phone (which has root), so I'm not 100% sure but it probably doesn't work without. It also doesn't seem to work when cross-compiling from Windows to Android, but when compiling directly on the device it's used on it works.
Start by installing Termux from an app store.
pkg install golang gitNow the command go version should output something like go version go1.15.3 android/arm64.
git clone https://github.com/xarantolus/upduck.git && cd upduckgo build$PATH:mv upduck ~/../usr/bin/Now you can run it just like shown in the help section above. Please also make sure that the Termux app has the storage permission.
I recommend using the Termux Widget for upduck. For that, you can put scripts to start & stop this server in ~/.shortcuts/tasks, they could look like this (after configuring this server once with the -save flag):
A script to start the server:
upduck:
#!/usr/bin/bash
sudo upduck -dir /storage/emulated/0 # Fill in any path you likeA script to stop the server running in the background:
stopduck:
#!/usr/bin/bash
sudo killall upduckNow you can tap the widget any time to start/stop the server, which means that you'll never have to get up to find a cable ever again. At least when you're in a network where you configured upduck correctly.
To get a DuckDNS subdomain, you'll need to register on their site and then create a domain. The prefix you type in is the -site parameter of your program, your token is for the -token option.
Now that we have the domain, we'll need to make sure the router is set up correctly. For this, you'll need to forward a port in your router to port 443 (or the one set with -sp) of the device upduck is running on. This port will be part of your external address, e.g. mysite.duckdns.org:port, where port is a number.
When you did that, you can run upduck like this:
upduck -email [email protected] -token DuckDNSToken -site mysiteThe email address will be sent to Let's Encrypt as part of obtaining an HTTPS certificate.
This should start a local HTTP web server on port 8080 and an HTTPS server on port 443. The second one should receive the requests that are forwarded from your router.
Since typing out all arguments can become tiresome, you can save them quite easily. They will then be reloaded on the next start.
Disclaimer: Writing your credentials to disk is a security risk since other programs might read that file. They could gain control over your DuckDNS account or find out your email address.
To save settings, just add the -save flag to your normal command line. The next time, your credentials will be restored and you don't have to remember them or type them every time.
Saved settings are loaded automatically if no new options for DuckDNS are given.
When the config file is loaded, the following settings can be overwritten by command line flags: port with -p and directory listings with -disallow-listings. This means that you can run upduck -p 2020 to get the local server while still getting the DuckDNS server if it was ever set up with -save.
You can create user accounts to control access as outlined in the "User configuration" section of the help output. These accounts are loaded with every start of the server, so you only need to set it up once.
Logging in is done using HTTP Basic Auth. This means that the login duration depends on how long a browser saves the given username/password combination.
Contributions, suggestions, questions and any issue reports are very welcome. Please don't hesistate to ask :)
This is free as in freedom software. Do whatever you like with it.
No open issues yet, or sync has not completed.