Access your servers securely with a Magic URL
Dance the Two-Step
Earlier I promised to show you how I integrated other security layers with my Magic URL. You briefly saw how I tidied up any fail2ban iptables rules for my dynamic IP address within the main script. Here, I will take a quick look at some two-step authentication configuration.
I will leave you to research the finer details of setting up your two-step verification with the excellent Google Authenticator. However, should you want to add functionality to your Magic URL, wherein IP addresses you know and trust don't have to run through the two-step code-entering process but instead are just asked for a password, then you can use code like this:
echo -e "+ : ALL : 51.15.2.14/24 + : ALL : ${GSM} - : ALL : ALL" > /etc/security/access-local.conf
As you can see, ${GSM}
is the IP address extracted from the Magic URL functionality. If asked, I would say use this with caution and probably only allow fixed-line IP addresses to connect over SSH without running through the two-step process.
The End
Although this approach to opening up access is rudimentary in places, I would like to think it encourages sys admins to develop their lateral thinking. The fact that you can get htaccess to deal with unique IP addresses, rename the Magic URL every minute with a new timestamp derivative (or via another security token), and incorporate other failsafes into a security design raises many questions about how far it's possible to go in securing a server using relatively basic tools.
If you know that you won't be able to carry your SSH key with you for a period of time, you could take two-step authentication scratch codes with you on a piece of paper (or just switch off two-step completely) and still get SSH access relatively securely from anywhere on the planet using this approach.
Something else I might try in the future is spawning another type of task or application with a Magic URL. I didn't want a big clunky Submit button embedded within a web page to allow Magic URL functionality, but you could easily customize this approach to run any service or script you like.
Having read about the Magic URL I use for my CCTV server, I hope you will attempt some of these methods in a creative way to suit your own security needs.
Infos
- htaccess: http://www.htaccess-guide.com
- fail2ban: http://www.fail2ban.org/wiki/index.php/Main_Page
- "Intrusion Detection with fail2ban" by Chris Binnie: http://www.linux-magazine.com/Online/Features/Intrusion-Detection-with-Fail2ban
- "Secure Your Server with TCP Wrappers" by Chris Binnie: http://www.admin-magazine.com/Articles/Secure-Your-Server-with-TCP-Wrappers
- Code for this article: ftp://ftp.linux-magazine.com/pub/listings/magazine/190
- Binnie, Chris,. Linux Server Security: Hack and Defend. Wiley, 2016, http://www.amazon.com/Linux-Server-Security-Hack-Defend/dp/1119277655/
« Previous 1 2 3 4
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
Canonical Bumps LTS Support to 12 years
If you're worried that your Ubuntu LTS release won't be supported long enough to last, Canonical has a surprise for you in the form of 12 years of security coverage.
-
Fedora 40 Beta Released Soon
With the official release of Fedora 40 coming in April, it's almost time to download the beta and see what's new.
-
New Pentesting Distribution to Compete with Kali Linux
SnoopGod is now available for your testing needs
-
Juno Computers Launches Another Linux Laptop
If you're looking for a powerhouse laptop that runs Ubuntu, the Juno Computers Neptune 17 v6 should be on your radar.
-
ZorinOS 17.1 Released, Includes Improved Windows App Support
If you need or desire to run Windows applications on Linux, there's one distribution intent on making that easier for you and its new release further improves that feature.
-
Linux Market Share Surpasses 4% for the First Time
Look out Windows and macOS, Linux is on the rise and has even topped ChromeOS to become the fourth most widely used OS around the globe.
-
KDE’s Plasma 6 Officially Available
KDE’s Plasma 6.0 "Megarelease" has happened, and it's brimming with new features, polish, and performance.
-
Latest Version of Tails Unleashed
Tails 6.0 is based on Debian 12 and includes GNOME 43.
-
KDE Announces New Slimbook V with Plenty of Power and KDE’s Plasma 6
If you're a fan of KDE Plasma, you'll be thrilled to hear they've announced a new Slimbook with an AMD CPU and the latest version of KDE Plasma desktop.
-
Monthly Sponsorship Includes Early Access to elementary OS 8
If you want to get a glimpse of what's in the pipeline for elementary OS 8, just set up a monthly sponsorship to help fund its continued existence.