Appdynamics / Appdynamics/HA-toolkit

install-init.sh -s needs to parse possible combinations of #includedir /etc/sudoers.d path in /etc/sudoers

Open
#30 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
Shell
Stars
13
Forks
11
PR merge metrics
No merged PRs in 30d

Description

**Customer environment:**

1) RHEL 6.2
2) HA version 3.5.3
3) Customised /etc/sudoers file

**Issue:**

1) "install-init.sh -s" looks for /etc/sudoers.d in /etc/sudoers

grep -Eq "^#includedir[\t ]+/etc/sudoers.d[\t ]*$" /etc/sudoers

2) But this regex does not match "/etc/sudoers.d/" entry (note the / at the end) in /etc/sudoers

3) So the install script adds the following line in /etc/sudoers
# include /etc/sudoers.d/appdynamics

4) Now the /etc/sudoers include both /etc/sudoers.d and /etc/sudoers.d/appdynamics

5) This breaks sudoers, complaining alias APPD is already defined. This is because /etc/sudoers has two includes.

ssh -t secondary sudo -n /sbin/service appdcontroller-db start

> > > /etc/sudoers.d/appdynamics: Alias `APPD' already defined near line 7 <<<
> > > sudo: parse error in /etc/sudoers.d/appdynamics near line 7
> > > sudo: no valid sudoers sources found, quitting

**Code fix:**

Match for both /etc/sudoers.d and /etc/sudoers.d/ in install-init.sh

```

Change:
grep -Eq "^#includedir[\t ]+/etc/sudoers.d[\t ]*$" /etc/sudoers

TO:
grep -Eq "^#includedir[\t ]+/etc/sudoers.d/?[\t ]*$" /etc/sudoers

```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.