@@ -5,7 +5,7 @@ FROM ${ELEMENTAL_REGISTER} as register
5
5
FROM ${ELEMENTAL_TOOLKIT} as toolkit
6
6
7
7
# OS base image of our choice
8
- FROM registry.opensuse.org/ opensuse/ leap: 15.5 as OS
8
+ FROM registry.opensuse.org/ opensuse/ tumbleweed:latest as OS
9
9
10
10
ARG RANCHER_SYSTEM_AGENT_VERSION
11
11
@@ -53,10 +53,25 @@ RUN ARCH=$(uname -m); \
53
53
RUN ARCH= $(uname - m); \
54
54
[[ "${ARCH}" == "aarch64" ]] && ARCH= "arm64" ; \
55
55
zypper -- non- interactive install -- no- recommends -- \
56
- dmidecode
56
+ dmidecode \
57
+ libopenssl1_1
58
+
59
+ # SELinux policy and tools
60
+ RUN ARCH= $(uname - m); \
61
+ [[ "${ARCH}" == "aarch64" ]] && ARCH= "arm64" ; \
62
+ zypper -- non- interactive install -- no- recommends -- \
63
+ patterns- microos- selinux \
64
+ k3s- selinux \
65
+ audit
57
66
58
67
# Add system files
59
68
COPY framework/ files/ /
69
+
70
+ # Enable SELinux (The security= selinux arg is default on Micro, not on Tumbleweed)
71
+ RUN sed - i "s/selinux=1/security=selinux selinux=1/g" / etc/ elemental/ bootargs.cfg
72
+ # Enforce SELinux
73
+ # RUN sed - i "s/enforcing=0/enforcing=1/g" / etc/ elemental/ bootargs.cfg
74
+
60
75
# Add elemental- register
61
76
COPY -- from= register / usr/ sbin/ elemental- register / usr/ sbin/ elemental- register
62
77
COPY -- from= register / usr/ sbin/ elemental- support / usr/ sbin/ elemental- support
@@ -67,17 +82,31 @@ COPY --from=toolkit /usr/bin/elemental /usr/bin/elemental
67
82
ADD -- chmod= 0755 https://github.com/rancher/system-agent/releases/download/${RANCHER_SYSTEM_AGENT_VERSION}/rancher-system-agent-amd64 /usr/sbin/elemental-system-agent
68
83
69
84
# Enable essential services
70
- RUN systemctl enable NetworkManager.service
85
+ RUN systemctl enable NetworkManager.service sshd
86
+
87
+ # This is for testing purposes, do not do this in production.
88
+ RUN echo "PermitRootLogin yes" > / etc/ ssh/ sshd_config.d/ rootlogin.conf
71
89
72
- # Enable / tmp to be on tmpfs
73
- RUN cp / usr/ share / systemd / tmp.mount / etc / systemd / system
90
+ # Make sure trusted certificates are properly generated
91
+ RUN / usr/ sbin / update - ca - certificates
74
92
75
- # Generate initrd with required elemental services
76
- RUN elemental init -- debug -- force
93
+ # Ensure / tmp is mounted as tmpfs by default
94
+ RUN if [ - e / usr/ share/ systemd/ tmp.mount ]; then \
95
+ cp / usr/ share/ systemd/ tmp.mount / etc/ systemd/ system; \
96
+ fi
97
+
98
+ # Save some space
99
+ RUN zypper clean -- all && \
100
+ rm - rf / var/ log/ update* && \
101
+ > / var/ log/ lastlog && \
102
+ rm - rf / boot/ vmlinux*
77
103
78
104
# Update os- release file with some metadata
79
105
RUN echo TIMESTAMP= "`date +'%Y%m%d%H%M%S'`" >> / etc/ os- release && \
80
106
echo GRUB_ENTRY_NAME= \"Elemental Dev\" >> / etc/ os- release
81
107
108
+ # Rebuild initrd to setup dracut with the boot configurations
109
+ RUN elemental init -- force elemental- rootfs, elemental- sysroot, grub- config, dracut- config, cloud- config- essentials, elemental- setup, boot- assessment
110
+
82
111
# Good for validation after the build
83
112
CMD / bin/ bash
0 commit comments