Skip to content

Commit

Permalink
feat(modules): user module
Browse files Browse the repository at this point in the history
  • Loading branch information
manusa committed Jun 21, 2024
1 parent b8a170b commit 26b290b
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
11 changes: 11 additions & 0 deletions modules/org.eclipse.jkube.user/configure.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash
set -e

# Create a user and group used to launch processes
# We use the ID 185 for the group as well as for the user.
# This ID is registered static ID for the JBoss EAP product
# on RHEL which makes it safe to use.
groupadd -r $USER -g $UID && useradd -u $UID -r -g root -G $USER -m -d $HOME -s /sbin/nologin -c "$GECOS" $USER

# OPENJDK-533, OPENJDK-556: correct permissions for OpenShift etc
chmod 0770 $HOME
30 changes: 30 additions & 0 deletions modules/org.eclipse.jkube.user/module.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
schema_version: 1
name: org.eclipse.jkube.user
version: 1.0.0
description: >
Configures the default user and permissions. This module should be included by all images.
Adapted from:
- https://github.com/jboss-container-images/openjdk/blob/d14ec7f363956b73684409c8b6bd9c766507013b/modules/user/
- https://github.com/jboss-openshift/cct_module/blob/f91fb2f80dd880ed7498d4dfc3afb35dfcef60bd/jboss/container/user/
envs:
- name: "USER"
value: "jboss"
- name: "UID"
value: &uid 185
- name: "HOME"
value: "/home/jboss"
- name: "GECOS"
value: "JBoss user"

packages:
install:
- shadow-utils # groupadd

execute:
- script: configure.sh

run:
user: *uid
workdir: "/home/jboss"

0 comments on commit 26b290b

Please sign in to comment.