]> rtime.felk.cvut.cz Git - novaboot.git/commitdiff
Create tftpd.pid in default location
authoralberand <albershteyn.andrey@gmail.com>
Wed, 31 Mar 2021 20:51:58 +0000 (22:51 +0200)
committerMichal Sojka <michal.sojka@cvut.cz>
Mon, 28 Jun 2021 06:18:02 +0000 (08:18 +0200)
This way we restrict the user in commands which he can run under sudo.
It's better to use * wildcard in the pkill command as it doesn't write
anything to the filesystem.

novaboot
sudoers.novaboot

index 0c5d539a6c0aeb2d532b73a662e356dd818b20c5..2e70e7990327d9f189ce61317f90cef2cdd452a4 100755 (executable)
--- a/novaboot
+++ b/novaboot
@@ -1185,14 +1185,14 @@ r     \\.efi.*   \\.efi";
     close($fh);
     # Unfortunately, tftpd requires root privileges even with
     # non-privileged (>1023) port due to initgroups().
-    system_verbose("sudo in.tftpd --listen --secure -v -v -v --pidfile $builddir/tftpd.pid -m mapfile --address :$tftp_port $tftp_root");
+    system_verbose("sudo in.tftpd --listen --secure -v -v -v --pidfile tftpd.pid -m mapfile --address :$tftp_port $tftp_root");
 
     # Kill server when we die
     $SIG{__DIE__} = sub { system_verbose('sudo pkill --pidfile=dhcpd.pid') if (defined $dhcp_tftp);
-                         system_verbose('sudo pkill --pidfile=tftpd.pid'); };
+                         system_verbose("sudo pkill --pidfile=$tftp_root/tftpd.pid"); };
 
     # We have to kill tftpd explicitely, because it is not in our process group
-    $SIG{INT} = sub { system_verbose('sudo pkill --pidfile=tftpd.pid'); exit(0); };
+    $SIG{INT} = sub { system_verbose("sudo pkill --pidfile=$tftp_root/tftpd.pid"); exit(0); };
 }
 
 ### AMT IDE-R
index dd38f23075e77d5848343ab23f6b4e2bd59db7b1..75d223cf7e8a246b4d95e12bad4972818b58327d 100644 (file)
@@ -5,5 +5,5 @@
 # your_login ALL=NOPASSWD: NOVABOOT_DHCP
 
 # Uncomment the following lines to enable --dhcp-tftp and --tftp options
-# Cmnd_Alias NOVABOOT_TFTP = /usr/sbin/in.tftpd --listen --secure -v -v -v --pidfile */tftpd.pid *, /usr/bin/pkill --pidfile=tftpd.pid
+# Cmnd_Alias NOVABOOT_TFTP = /usr/sbin/in.tftpd --listen --secure -v -v -v --pidfile tftpd.pid *, /usr/bin/pkill --pidfile=*/tftpd.pid
 # your_login ALL=NOPASSWD: NOVABOOT_TFTP