Closed Bug 201554 Opened 23 years ago Closed 21 years ago

checksetup.pl gives un-necessary warning to non-root user with webservergroup access

Categories

(Bugzilla :: Installation & Upgrading, defect)

2.17.3
defect
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 2.18

People

(Reporter: justdave, Assigned: robzilla)

References

Details

Attachments

(2 files, 2 obsolete files)

If you have $webservergroup set, but run checksetup.pl as a non-root user, you get the following warning: --------- Warning: you have entered a value for the "webservergroup" parameter in localconfig, but you are not running this script as root. This can cause permissions problems and decreased security. If you experience problems running Bugzilla scripts, log in as root and re-run this script, or remove the value of the "webservergroup" parameter. Note that any warnings about "uninitialized values" that you may see below are caused by this. --------- If the user is not root, but *is* a member of the group named in $webservergroup, then this warning is unnecessary. We should test for it and skip the warning if that's the case. Suggested way to test for it is to attempt to chgrp a file to $webservergroup and either test for errors and/or go back and see if it actually changed.
*** Bug 246196 has been marked as a duplicate of this bug. ***
Wouldn't it be simpler to just compare the groupid of webservergroup with $( ??
Hmm, suppose it would. $( in list context does indeed give all of your groups and not just the primary. $) might be better though (effective group), which also gives all of them when referenced in list context.
Flags: blocking2.20+
Flags: blocking2.18+
Target Milestone: --- → Bugzilla 2.18
Whiteboard: bug awaiting patch
Attached patch rsiklos_v1 (obsolete) — Splinter Review
Patch for Trunk
Assignee: zach → rsiklos
Status: NEW → ASSIGNED
Attached patch rsiklos_v1-218 (obsolete) — Splinter Review
Patch for 2.18 branch
Attachment #168229 - Flags: review?
Attachment #168230 - Flags: review?
Whiteboard: bug awaiting patch → patch awaiting review
Comment on attachment 168229 [details] [diff] [review] rsiklos_v1 + my $webservergid = (getgrnam($my_webservergroup))[2]; Is there any chance of $webservergid to be undefined? Or is it guaranteed that getgrnam will always return a result? If there is a chance to be undef, the grep below will emit an undef warning and strange results. :-) +localconfig, but you are not either a) running this script as $::root; or b) a Not sure about: "not either" --> "neither" "or" --> "nor" but since I'm not a native English speaker, maybe the one evaluating the approval could put some light on this.
Attachment #168229 - Flags: review? → review+
Attachment #168230 - Flags: review? → review+
Flags: approval?
Flags: approval2.18?
Whiteboard: patch awaiting review → patch awaiting approval
Comment on attachment 168229 [details] [diff] [review] rsiklos_v1 >+ my $webservergid = (getgrnam($my_webservergroup))[2]; >+ if ($< != 0 && !grep(/^$webservergid$/, split(" ", $)))) { this will break on win32 (getgrnam is not implemented).
Attachment #168229 - Flags: review-
Comment on attachment 168230 [details] [diff] [review] rsiklos_v1-218 >- if ($< != 0) { # zach: if not root, yell at them, bug 87398 >+ my $webservergid = (getgrnam($my_webservergroup))[2]; >+ if ($< != 0 && !grep(/^$webservergid$/, split(" ", $)))) { same win32 breakage.
Attachment #168230 - Flags: review-
Comment on attachment 168229 [details] [diff] [review] rsiklos_v1 I thought about that as well but somehow my brain thought $my_webservergroup is undefined in Windows. Maybe we should do that instead (undef $my_webservergroup somewhere up in the .cgi); that would save us from checking the platform twice.
Attachment #168229 - Flags: review+
Attachment #168230 - Flags: review+
Flags: approval?
Flags: approval2.18?
Whiteboard: patch awaiting approval → bug awaiting patch
Rob, can you upload new patches in which you stick the new code inside a: if ($^O !~ /MSWin32/i) { // new, Unix-only code goes here } block? Thanks! :)
Attached patch rsiklos_v2-218Splinter Review
Ok, this should be better.
Attachment #168230 - Attachment is obsolete: true
Attached patch rsiklos_v2Splinter Review
patch v2 for trunk
Attachment #168229 - Attachment is obsolete: true
Attachment #168307 - Flags: review?
Attachment #168308 - Flags: review?
Whiteboard: bug awaiting patch → patch awaiting review
Attachment #168307 - Flags: review? → review+
Attachment #168308 - Flags: review? → review+
Flags: approval?
Flags: approval2.18?
Whiteboard: patch awaiting review → patch awaiting approval
Nit: the $::root variable contains "Administrator" on Win32 and "root" otherwise. This chunk of text is now inside a block that prevents it from running on Win32, so the use of the variable for it is unnecessary.
Flags: approval?
Flags: approval2.18?
Flags: approval2.18+
Flags: approval+
Whiteboard: patch awaiting approval → patch awaiting checkin
I thought about the $::root stuff as well, but then I thought that maybe sometimes we will be able to control ACL (access lists) from NTFS from Perl :-), and a Windows version of getgrnam will be available :) Heh, one can only dream :) But anyway, in the case where we will be able to port this code on Windows as well, file permissions security-wise, I won't like to replace "root" with "$::root" back again. So I guess leaving it as $::root for now doesn't make any harm.
Checking in checksetup.pl; /cvsroot/mozilla/webtools/bugzilla/checksetup.pl,v <-- checksetup.pl new revision: 1.314; previous revision: 1.313 done Checking in checksetup.pl; /cvsroot/mozilla/webtools/bugzilla/checksetup.pl,v <-- checksetup.pl new revision: 1.289.2.12; previous revision: 1.289.2.11 done
Status: ASSIGNED → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Whiteboard: patch awaiting checkin
QA Contact: matty_is_a_geek → default-qa
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: