Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add current user to adm group to access logs #4553

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ RUN dnf install -y sudo && \
useradd -u 1002 -g 1002 opensearch-dashboards && \
usermod -a -G opensearch $CONTAINER_USER && \
usermod -a -G opensearch-dashboards $CONTAINER_USER && \
usermod -a -G adm $CONTAINER_USER && \
id && \
echo "$CONTAINER_USER ALL=(root) NOPASSWD:`which systemctl`, `which env`, `which usermod`, `which dnf`, `which yum`, `which rpm`, `which chmod`, `which kill`, `which curl`, /usr/share/opensearch-dashboards/bin/opensearch-dashboards-plugin" >> /etc/sudoers.d/$CONTAINER_USER

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ RUN apt-get install -y sudo && \
useradd -u 1002 -g 1002 -s /bin/bash -d /home/opensearch-dashboards -m opensearch-dashboards && \
usermod -a -G opensearch $CONTAINER_USER && \
usermod -a -G opensearch-dashboards $CONTAINER_USER && \
usermod -a -G adm $CONTAINER_USER && \
id && \
echo "$CONTAINER_USER ALL=(root) NOPASSWD:`which systemctl`, `which env`, `which usermod`, `which apt`, `which apt-get`, `which apt-key`, `which dpkg`, `which chmod`, `which kill`, `which curl`, `which tee`, /usr/share/opensearch-dashboards/bin/opensearch-dashboards-plugin" >> /etc/sudoers.d/$CONTAINER_USER

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ RUN dnf install -y sudo && \
groupadd -g 1002 opensearch-dashboards && \
useradd -u 1002 -g 1002 opensearch-dashboards && \
usermod -a -G opensearch $CONTAINER_USER && \
usermod -a -G opensearch-dashboards $CONTAINER_USER && \
usermod -a -G adm $CONTAINER_USER && \
id && \
echo "$CONTAINER_USER ALL=(root) NOPASSWD:`which systemctl`, `which env`, `which usermod`, `which dnf`, `which yum`, `which rpm`, `which chmod`, `which kill`, `which curl`, /usr/share/opensearch-dashboards/bin/opensearch-dashboards-plugin" >> /etc/sudoers.d/$CONTAINER_USER

Expand Down
6 changes: 3 additions & 3 deletions jenkins/opensearch-dashboards/integ-test.jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ def docker_images = [
]

def docker_args = [
"tar": "-u 1000 -e BROWSER_PATH=electron",
"rpm": "--entrypoint=/usr/lib/systemd/systemd -u root --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:rw --cgroupns=host -e BROWSER_PATH=electron",
"deb": "--entrypoint=/usr/lib/systemd/systemd -u root --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:rw --cgroupns=host -e BROWSER_PATH=electron",
peterzhuamazon marked this conversation as resolved.
Show resolved Hide resolved
"tar": "-u 1000",
"rpm": "--entrypoint=/usr/lib/systemd/systemd -u root --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:rw --cgroupns=host",
"deb": "--entrypoint=/usr/lib/systemd/systemd -u root --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:rw --cgroupns=host",
"zip": "-u ContainerAdministrator",
]

Expand Down
4 changes: 3 additions & 1 deletion src/test_workflow/integ_test/distribution_deb.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ def install(self, bundle_name: str) -> None:
'&&',
f'sudo chmod 0755 {os.path.dirname(self.config_path)} {self.log_dir}',
'&&',
f'sudo usermod -a -G {self.filename} `whoami`'
f'sudo usermod -a -G {self.filename} `whoami`',
'&&',
'sudo usermod -a -G adm `whoami`'
]
)
subprocess.check_call(deb_install_cmd, cwd=self.work_dir, shell=True)
Expand Down
4 changes: 3 additions & 1 deletion src/test_workflow/integ_test/distribution_rpm.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ def install(self, bundle_name: str) -> None:
'&&',
f'sudo chmod 0755 {os.path.dirname(self.config_path)} {self.log_dir}',
'&&',
f'sudo usermod -a -G {self.filename} `whoami`'
f'sudo usermod -a -G {self.filename} `whoami`',
'&&',
'sudo usermod -a -G adm `whoami`'
]
)
subprocess.check_call(rpm_install_cmd, cwd=self.work_dir, shell=True)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ def test_install(self, check_call_mock: Mock) -> None:
"dpkg --install opensearch.deb && "
f"sudo chmod 0666 {self.distribution_deb.config_path} && "
f"sudo chmod 0755 {os.path.dirname(self.distribution_deb.config_path)} {self.distribution_deb.log_dir} && "
f"sudo usermod -a -G opensearch `whoami`"
f"sudo usermod -a -G opensearch `whoami` && "
f"sudo usermod -a -G adm `whoami`"
),
args_list[0][0][0],
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ def test_install(self, check_call_mock: Mock) -> None:
"yum install -y opensearch.rpm && "
f"sudo chmod 0666 {self.distribution_rpm.config_path} && "
f"sudo chmod 0755 {os.path.dirname(self.distribution_rpm.config_path)} {self.distribution_rpm.log_dir} && "
f"sudo usermod -a -G opensearch `whoami`"
f"sudo usermod -a -G opensearch `whoami` && "
f"sudo usermod -a -G adm `whoami`"
),
args_list[0][0][0],
)
Expand Down
Loading