From bf45fc550f5d851790772bc93e7caa2550033d8c Mon Sep 17 00:00:00 2001 From: krizej <60076189+krizej@users.noreply.github.com> Date: Wed, 24 Apr 2024 22:06:16 +0200 Subject: [PATCH] feat: add client-side script --- client/sudo | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 client/sudo diff --git a/client/sudo b/client/sudo new file mode 100755 index 0000000..550e63f --- /dev/null +++ b/client/sudo @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +url="https://sudo-parental-control.jacekpoz.pl" + +json=$(echo '{"username":"'$USER'","command":"'$@'"}') +r=$(curl -s -X POST $url --data "$json") + +if [ "$r" = "ok" ]; then + echo "Parental control approves the request" + sudo $@ +else + echo "Parental control prohibits the usage of sudo" + echo "Reason: $r" +fi +