[sudo-users] Test for -E support

Jeffrey Walton noloader at gmail.com
Sat Mar 28 15:46:53 MDT 2020


On Sat, Mar 28, 2020 at 3:54 PM Todd C. Miller <Todd.Miller at sudo.ws> wrote:
>
> On Sat, 28 Mar 2020 14:17:23 -0400, Jeffrey Walton wrote:
>
> > Some of the older machines in my testing environment does not support
> > -E. The first thing I need is, detect the problem. Preferably the test
> > would not use a password. It just tests for the -E option.
>
> You must be running a very old version of sudo on those machines,
> the -E flag was introduced 15 years ago in sudo 1.6.8p12.

Yeah, a PowerMac antique. It is circa 2005.

Its a good testing box: OS X 10.5, Apple GCC 4.0.1, Altivec, big-endian.

I provide SSH access if interested. Email your authorized_keys file.

> > So I'm thinking I can check for -E with:
> >
> >     NO_E_OPT=`sudo -E -h 2>&1 | grep -i -c illegal`
> >
> > And then:
> >
> >     # PowerMac
> >     $ NO_E_OPT=`sudo -E -h 2>&1 | grep -i -c illegal`; echo $NO_E_OPT
> >     1
> >     # Ubuntu
> >     $ NO_E_OPT=`sudo -E -h 2>&1 | grep -i -c illegal`; echo $NO_E_OPT
> >     0
> >
> > Does that look about right? Or is there a better way to do this?
>
> What you have should work just fine.  Sudo 1.6.x displays "illegal
> option" for unrecognized options where 1.7.0 and higher uses "unknown
> option".  This is not an issue, however, as the -E option is supported
> by all sudo 1.7.x (and 1.8.x) versions anyway.

Ack, thanks.

> All that being said, you might want to consider building a newer
> version of sudo on those machines if possible.

Ack, thanks.

Jeff


More information about the sudo-users mailing list