This repository was archived by the owner on Apr 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
SCMOD-12755: Allow startup scripts to run as non-root user. #23
Open
dgibson-microfocus
wants to merge
7
commits into
develop
Choose a base branch
from
SCMOD-12755
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
5c9951d
SCMOD-12755: Allow startup scripts to run as non-root user.
dgibson-microfocus a6d7a32
fix
dgibson-microfocus ac9cff2
Allow users to run specific commands as sudo
dgibson-microfocus 7b298b3
code review
dgibson-microfocus 5107b03
fix license header
dgibson-microfocus 68a7914
review
dgibson-microfocus afcbd5b
Merge branch 'develop' into SCMOD-12755
rorytorneymf File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| #!/bin/bash | ||
| # | ||
| # Copyright 2017-2020 Micro Focus or one of its affiliates. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| # | ||
|
|
||
| MESOS_SANDBOX=${SSL_CA_CRT_DIR:-$MESOS_SANDBOX} | ||
|
|
||
| copy_certs() { | ||
| IFS=',' read -a caFiles <<< "$SSL_CA_CRT" | ||
|
|
||
| for caFile in "${caFiles[@]}" | ||
| do | ||
| if ! [ -e $MESOS_SANDBOX/$caFile ] | ||
| then | ||
| echo "CA Certificate at '$MESOS_SANDBOX/$caFile' not found" | ||
| echo "Aborting further system CA certificate load attempts." | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "Installing CA Certificate on $1" | ||
| sudo cp -v $MESOS_SANDBOX/$caFile $2/$caFile.crt | ||
| done | ||
| } | ||
|
|
||
| if [ -n "$MESOS_SANDBOX" ] && [ -n "$SSL_CA_CRT" ] | ||
| then | ||
| copy_certs "openSUSE" /etc/pki/trust/anchors | ||
| sudo update-ca-certificates | ||
| else | ||
| echo "Not installing CA Certificate." | ||
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -36,13 +36,5 @@ done | |||||||
|
|
||||||||
| log "Startup scripts completed" | ||||||||
|
|
||||||||
| # If the RUNAS_USER environment variable is set, execute the specified command as that user. | ||||||||
| if [ -n "$RUNAS_USER" ]; then | ||||||||
| log "The RUNAS_USER environment variable has been set with a user named ${RUNAS_USER}. \ | ||||||||
| Subsequent commands will be run as this user. \ | ||||||||
| Please note that this user is expected to already exist, and will not be created." | ||||||||
| exec /usr/local/bin/gosu $RUNAS_USER "$@" | ||||||||
| else | ||||||||
| log "The RUNAS_USER environment variable is not set, subsequent commands will be run as the default user." | ||||||||
| exec "$@" | ||||||||
| fi | ||||||||
| # Execute the specified command | ||||||||
| exec "$@" | ||||||||
dermot-hardy marked this conversation as resolved.
Show resolved
Hide resolved
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's put the comment back so that it's back the way it was before the gosu changes.
Suggested change
|
||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ALL ALL=(ALL) NOPASSWD: /bin/cp * /etc/pki/trust/anchors*, /usr/sbin/update-ca-certificates |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.