-
Notifications
You must be signed in to change notification settings - Fork 3
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 security settings #25
Changes from all commits
2396442
4b128c9
352ed13
97dab0f
c64c26d
cb000ac
8ff32cf
494f978
5ba423f
f8e5907
291f22d
8cdea45
69449c3
470348f
0ed4732
b20ffe1
bbff857
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,52 +5,66 @@ base: ubuntu:22.04 # the base environment for this ROCK | |
version: "5.0.14-12" # just for humans. Semantic versioning is recommended | ||
summary: MongoDB in a rock. # 79 char long summary | ||
description: | | ||
MongoDB is a source-available cross-platform | ||
document-oriented database program. Classified | ||
as a NoSQL database program, MongoDB uses JSON | ||
-like documents with optional schemas. | ||
MongoDB is a source-available cross-platform | ||
document-oriented database program. Classified | ||
as a NoSQL database program, MongoDB uses JSON | ||
-like documents with optional schemas. | ||
license: Apache-2.0 # your application's SPDX license | ||
entrypoint: | ||
dmitry-ratushnyy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- /usr/bin/setpriv | ||
- --clear-groups | ||
- --reuid | ||
- mongodb | ||
- --regid | ||
- mongodb | ||
- -- | ||
- /usr/bin/mongod | ||
- /usr/bin/setpriv | ||
- --clear-groups | ||
- --reuid | ||
- mongodb | ||
- --regid | ||
- mongodb | ||
- -- | ||
- /usr/bin/mongod | ||
|
||
platforms: # The platforms this ROCK should be built on and run on | ||
amd64: | ||
amd64: | ||
|
||
parts: | ||
mongo-snap: | ||
plugin: nil | ||
stage-snaps: | ||
- charmed-mongodb/5/edge | ||
overlay-packages: | ||
- ca-certificates | ||
dep-debs: | ||
plugin: nil | ||
stage-packages: | ||
- util-linux | ||
- libssh-4 | ||
- libbrotli1 | ||
non-root-user: | ||
plugin: nil | ||
after: [mongo-snap] | ||
overlay-script: | | ||
# Create a user in the $CRAFT_OVERLAY chroot | ||
groupadd -R $CRAFT_OVERLAY -g 584788 mongodb | ||
useradd -R $CRAFT_OVERLAY -M -r -g mongodb -u 584788 mongodb | ||
override-prime: | | ||
craftctl default | ||
# Give permission and create the required directories | ||
mkdir -p $CRAFT_PRIME/data/db | ||
chmod 0755 $CRAFT_PRIME/data/db | ||
chown -R 584788:584788 $CRAFT_PRIME/data/db | ||
rock-license: | ||
plugin: dump | ||
source: licenses | ||
organize: | ||
LICENSE-rock: licenses/LICENSE-rock | ||
mongo-snap: | ||
plugin: nil | ||
stage-snaps: | ||
- charmed-mongodb/5/edge | ||
overlay-packages: | ||
- ca-certificates | ||
dep-debs: | ||
plugin: nil | ||
stage-packages: | ||
- libssh-4 | ||
- libbrotli1 | ||
non-root-user: | ||
plugin: nil | ||
after: [mongo-snap] | ||
overlay-script: | | ||
# Create a user in the $CRAFT_OVERLAY chroot | ||
groupadd -R $CRAFT_OVERLAY -g 584788 mongodb | ||
useradd -R $CRAFT_OVERLAY -M -r -g mongodb -u 584788 mongodb | ||
override-prime: | | ||
craftctl default | ||
# Give permission and create the required directories | ||
mkdir -p $CRAFT_PRIME/data/db | ||
chmod 0755 $CRAFT_PRIME/data/db | ||
chown -R 584788:584788 $CRAFT_PRIME/data/db | ||
# enable security monitoring | ||
rocks=usr/share/rocks/ | ||
mkdir -p ${rocks} | ||
## for deb packages | ||
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. nit can we have enters after the comments 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. I can try but linter was complaining about those 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. hmm maybe we can copy the linter from opensearch? they seem to have less problems, and then you could have the dpkg command the way you originally intended? (doesn't have to be now) but would be good long term if we had our linters alligned across products on the NoSQL team 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. looks like opensearch rock does not have a linter (if I am not missing anything) |
||
declare -a arr=() | ||
arr+=('${db:Status-Abbrev},') | ||
arr+=('${binary:Package},') | ||
arr+=('${Version},') | ||
arr+=('${source:Package},') | ||
arr+=('${Source:Version}\n') | ||
dpkg-query -W -f "${arr[*]}" > ${rocks}/dpkg.query | ||
## for snap packages | ||
cp snap.charmed-mongodb/manifest.yaml ${rocks} | ||
cp snap.charmed-mongodb/snapcraft.yaml ${rocks} | ||
|
||
rock-license: | ||
plugin: dump | ||
source: licenses | ||
organize: | ||
LICENSE-rock: licenses/LICENSE-rock |
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.
Noob question: why different charmcraft here than in integration?
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.
AFAIK it is actually the same version, but in this case we install it while in case of integration test we update the installed one