From 39b5e46b028774d4b1627edbe1851eb79f9b7a4b Mon Sep 17 00:00:00 2001 From: gashapwn Date: Sat, 28 Nov 2020 20:50:18 +0000 Subject: [PATCH] provision.pl: added check for root user. added author header --- perl-script/provision.pl | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/perl-script/provision.pl b/perl-script/provision.pl index d2017c5..aa187b6 100644 --- a/perl-script/provision.pl +++ b/perl-script/provision.pl @@ -3,11 +3,27 @@ use warnings; use strict; +# provision.pl +# script to provision a tilde instance +# # This script is intended to be run on a fresh # OpenBSD install +# +# gashapwn +# Nov 2020 + +my $pwuid; my $admin_un; + +# Make sure we're running as root +$pwuid = getpwuid( $< ); + +if($pwuid ne "root"){ + die "script must be run as root"; +} + # Check /etc/passwd for the username created during # installation if( ($admin_un) = `tail /etc/passwd | grep -v "nobody:"` =~ /([^:]+):[^:]+:[0-9]{4,}/){