Description
Mason James
2012-09-10 05:19:37 UTC
Created attachment 12107 [details] [review] Addition of "executed by user" check to warn if execute by root user. This patch will check the uid of user who executed the script. If it is the root user a warning will be issued and die. A user can force "execute as root" by using the -runas-root switch. Created attachment 13274 [details] [review] Bug 8745 - Disallow rebuild_zebra.pl from executing, when run by root user. Added a check to warn users of execution as root user. Added a 'runas-root' switch to allow users to force execution as root user. Signed-off-by: Mason James <mtj@kohaaloha.com> (In reply to comment #2) > Created attachment 13274 [details] [review] > Signed-off-by: Mason James <mtj@kohaaloha.com> just tested this patch, it works well... thanks for the patch Barry! :) > Added a 'runas-root' switch to allow users to force execution as root user.
just a quickie...
1/ i 'improved' the arg name to --run-as-root
2/ and added a help section for the arg too
Hi Mason, There are debug messages in your SO patch. Sorry about that, I know it is the second time I bore you with that but I think it is unnecessary to load the Smart::comments module in this patch. Created attachment 13477 [details] [review] Bug 8745 - Disallow rebuild_zebra.pl from executing, when run by root user. Added a check to warn users of execution as root user. Added a 'runas-root' switch to allow users to force execution as root user. Signed-off-by: Mason James <mtj@kohaaloha.com> (In reply to comment #5) > Hi Mason, > > Sorry about that, I know it is the second time I bore you with that but I > think it is unnecessary to load the Smart::comments module in this patch. i've fixed this, a new patch is attached... This patch cannot work. the following line is wrong: if( undef $run_as_root and $run_user eq 'root') undef $run_as_root is always false. You wanted write if ( not defined $run_as_root and $run_user eq 'root' ) Marked as Failed QA. Created attachment 17116 [details] [review] Bug 8745 - Disallow rebuild_zebra.pl from executing, when run by root user. Added a check to warn users of execution as root user. Added a 'runas-root' switch to allow users to force execution as root user. Signed-off-by: Mason James <mtj@kohaaloha.com> Created attachment 17117 [details] [review] Bug 8745 - Disallow rebuild_zebra.pl from executing, when run by root user. Added a check to warn users of execution as root user. Added a 'runas-root' switch to allow users to force execution as root user. Signed-off-by: Mason James <mtj@kohaaloha.com> Created attachment 17118 [details] [review] general whitespace and tab tidy (In reply to comment #8) > This patch cannot work. > > the following line is wrong: > if( undef $run_as_root and $run_user eq 'root') > > undef $run_as_root is always false. > > You wanted write > if ( not defined $run_as_root and $run_user eq 'root' ) > > Marked as Failed QA. Jonathan, thanks for spotting the mistake. i have fixed it now (In reply to comment #1) > Created attachment 12107 [details] [review] [review] > Addition of "executed by user" check to warn if execute by root user. > > This patch will check the uid of user who executed the script. If it is the > root user a warning will be issued and die. A user can force "execute as > root" by using the -runas-root switch. to test, apply patch... 1/ run script as root user, script should quit 2/ run script as root user with -run-as-root arg, script should *not* quit Created attachment 17266 [details] [review] [PASSED QA] Bug 8745 - Disallow rebuild_zebra.pl from executing, when run by root user. Added a check to warn users of execution as root user. Added a 'runas-root' switch to allow users to force execution as root user. Signed-off-by: Mason James <mtj@kohaaloha.com> Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> Created attachment 17267 [details] [review] [PASSED QA] Bug 8745: General whitespace and tab tidy http://bugs.koha-community.org/show_bug.cgi?id=8745 Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> 1) Runs not with root. 2) Runs with root and -run-as-root. 3) Runs using the normal koha user. Note: Maybe the message should be clear about why running as root is bad and which user you should be running the script with? This patch has been pushed to master and 3.12.x. Good patch, may break running systems though, so will not push to stable branches. |