Nmap Development mailing list archives

Re: Patch to make Zenmap respect NMAP_PRIVILEGED environment variable


From: David Fifield <david () bamsoftware com>
Date: Wed, 23 Jan 2013 12:45:04 -0800

On Wed, Jan 23, 2013 at 02:51:20PM +0000, Tyler J. Wagner wrote:
I have configured nmap for unprivileged users:

setcap cap_net_raw,cap_net_admin,cap_net_bind_service+eip /usr/bin/nmap
chgrp adm /usr/bin/nmap
chmod 750 /usr/bin/nmap

And set NMAP_PRIVILEGED in .xsessionrc, inherited by all terminals and shells:

export NMAP_PRIVILEGED="yes"

I can now perform all nmap functions (as far as I can tell) as my normal
user. This even works with Zenmap. However, Zenmap still displays an
annoying warning on startup:

You are trying to run Zenmap with a non-root user! Some Nmap options need
root privileges to work.

The attached patch, written against Zenmap 6.0.0 as distributed in Ubuntu
12.10, fixes this. During startup, when Zenmap checks if the user is root,
is also checks if the environment variable is set.

Thanks for this. Please make a couple of changes and we'll merge the
patch.

Move the NMAP_PRIVILEGED check into the is_root function.

Add a check for NMAP_UNPRIVILEGED too, by analogy with the check in
NmapOps::Initialize in NmapOps.cc.

David Fifield
_______________________________________________
Sent through the dev mailing list
http://nmap.org/mailman/listinfo/dev
Archived at http://seclists.org/nmap-dev/


Current thread: