Skip to content

Commit fe722dd

Browse files
committed
DLPX-86523 CIS: /home filesystem and mount options
PR URL: https://www.github.com/delphix/appliance-build/pull/756
1 parent 05a5fe0 commit fe722dd

File tree

9 files changed

+41
-21
lines changed

9 files changed

+41
-21
lines changed

live-build/config/hooks/vm-artifacts/90-raw-disk-image.binary

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ zfs create \
178178
-o mountpoint=/ \
179179
"$FSNAME/ROOT/$FSNAME/root"
180180

181-
zfs mount "$FSNAME/ROOT/$FSNAME/root"
181+
zfs mount -o nodev "$FSNAME/ROOT/$FSNAME/root"
182182

183183
#
184184
# We are later going to recursively bind mount /proc/, /sys/, and /dev/
@@ -261,8 +261,8 @@ zfs create \
261261
# contents. During normal boot up, we'll rely on "/etc/fstab" to handle
262262
# these mounts.
263263
#
264-
mkdir -p "$DIRECTORY/export/home"
265-
mount -t zfs "$FSNAME/ROOT/$FSNAME/home" "$DIRECTORY/export/home"
264+
mkdir -p "$DIRECTORY/home"
265+
mount -t zfs "$FSNAME/ROOT/$FSNAME/home" "$DIRECTORY/home"
266266

267267
mkdir -p "$DIRECTORY/var/delphix"
268268
mount -t zfs "$FSNAME/ROOT/$FSNAME/data" "$DIRECTORY/var/delphix"
@@ -292,7 +292,7 @@ rsync --info=stats3 -Wa binary/* "$DIRECTORY/"
292292
# automatically whenever we boot into the crash kernel.
293293
#
294294
cat <<-EOF >"$DIRECTORY/etc/fstab"
295-
rpool/ROOT/$FSNAME/home /export/home zfs defaults,x-systemd.before=zfs-import-cache.service 0 0
295+
rpool/ROOT/$FSNAME/home /home zfs defaults,x-systemd.before=zfs-import-cache.service 0 0
296296
rpool/ROOT/$FSNAME/data /var/delphix zfs defaults,x-systemd.before=zfs-import-cache.service 0 0
297297
rpool/ROOT/$FSNAME/log /var/log zfs defaults,x-systemd.before=zfs-import-cache.service 0 0
298298
rpool/crashdump /var/crash zfs defaults,x-systemd.before=zfs-import-cache.service,x-systemd.before=kdump-tools.service 0 0
@@ -335,7 +335,7 @@ done
335335

336336
umount "$DIRECTORY/var/log"
337337
umount "$DIRECTORY/var/delphix"
338-
umount "$DIRECTORY/export/home"
338+
umount "$DIRECTORY/home"
339339
umount "/var/crash"
340340
retry 5 10 zfs umount "$FSNAME/ROOT/$FSNAME/root"
341341
retry 5 10 zpool export "$FSNAME"

live-build/misc/ansible-roles/appliance-build.masking-development/tasks/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@
2626
- git:
2727
repo: "https://{{ lookup('env', 'GITHUB_TOKEN') }}@github.com/delphix/dms-core-gate.git"
2828
dest:
29-
"/export/home/delphix/dms-core-gate"
29+
"/home/delphix/dms-core-gate"
3030
version: "develop"
3131
accept_hostkey: yes
3232
update: no
3333
when: lookup('env', 'GITHUB_TOKEN') != ''
3434

3535
- file:
36-
path: "/export/home/delphix/{{ item }}"
36+
path: "/home/delphix/{{ item }}"
3737
owner: delphix
3838
group: staff
3939
mode: "g+w"

live-build/misc/ansible-roles/appliance-build.minimal-common/tasks/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
no_log: true
2727

2828
- file:
29-
path: /export/home
29+
path: /home
3030
state: directory
3131
mode: 0755
3232

@@ -39,7 +39,7 @@
3939
shell: /bin/bash
4040
create_home: yes
4141
comment: Delphix User
42-
home: /export/home/delphix
42+
home: /home/delphix
4343
password:
4444
"{{ lookup('env', 'APPLIANCE_PASSWORD') | password_hash('sha512') }}"
4545

live-build/misc/ansible-roles/appliance-build.unittest-internal/tasks/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
- user:
8989
name: testrunner
9090
comment: "Delphix"
91-
home: /export/home/testrunner
91+
home: /home/testrunner
9292
groups: docker
9393
password:
9494
"$6$pWQE0MPZWgue7fNC$8RvR0u04Mt67792b.x4ao0G2Z/H/hrYPWezOqCkz59MIA\

live-build/misc/ansible-roles/appliance-build.virtualization-development/tasks/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,14 @@
7373
7474
- git:
7575
repo: "https://{{ lookup('env', 'GITHUB_TOKEN') }}@github.com/delphix/dlpx-app-gate.git"
76-
dest: "/export/home/delphix/dlpx-app-gate"
76+
dest: "/home/delphix/dlpx-app-gate"
7777
version: "develop"
7878
accept_hostkey: yes
7979
update: no
8080
when: lookup('env', 'GITHUB_TOKEN') != ''
8181

8282
- file:
83-
path: "/export/home/delphix/{{ item }}"
83+
path: "/home/delphix/{{ item }}"
8484
owner: delphix
8585
group: staff
8686
mode: "g+w"

live-build/misc/ansible-roles/appliance-build.zfsonlinux-development/tasks/main.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,26 +65,26 @@
6565
- git:
6666
repo: "https://{{ lookup('env', 'GITHUB_TOKEN') }}@github.com/delphix/zfs.git"
6767
dest:
68-
"/export/home/delphix/zfs"
68+
"/home/delphix/zfs"
6969
version: develop
7070
accept_hostkey: yes
7171
update: no
7272
when: lookup('env', 'GITHUB_TOKEN') != ''
7373

7474
- file:
75-
path: "/export/home/delphix/zfs"
75+
path: "/home/delphix/zfs"
7676
owner: delphix
7777
group: staff
7878
state: directory
7979
recurse: yes
8080

8181
- file:
82-
path: "/export/home/delphix/.cargo/"
82+
path: "/home/delphix/.cargo/"
8383
state: directory
8484
owner: delphix
8585
group: staff
8686
- copy:
87-
dest: "/export/home/delphix/.cargo/config.toml"
87+
dest: "/home/delphix/.cargo/config.toml"
8888
content: |
8989
[target.x86_64-unknown-linux-gnu]
9090
rustflags = ["-C", "link-arg=-B/usr/libexec/mold"]

scripts/common.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ function resolve_s3_uri() {
3636
# mirror is used.
3737
#
3838
UPSTREAM_BRANCH=$(get_upstream_or_fail_if_unset) || exit 1
39-
echo "Running with UPSTREAM_BRANCH set to ${UPSTREAM_BRANCH}"
39+
# echo "Running with UPSTREAM_BRANCH set to ${UPSTREAM_BRANCH}"
4040
local latest_subprefix="linux-pkg/${UPSTREAM_BRANCH}/combine-packages/post-push/latest"
4141
local bucket="snapshot-de-images"
4242
local jenkinsid="jenkins-ops"

upgrade/FAQ.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ resemble the following:
8989

9090
A "rootfs container" is a collection of ZFS datasets that can be used as
9191
the "root filesytsem" of the appliance. This includes a dataset for "/"
92-
of the appliance, but also seperate datasets for "/export/home" and
92+
of the appliance, but also seperate datasets for "/home" and
9393
"/var/delphix".
9494

9595
Here's an example of the datasets for a rootfs container:

upgrade/upgrade-scripts/upgrade-container

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ function create_upgrade_container() {
202202
-o mountpoint=legacy \
203203
"$ROOTFS_DATASET/home@$SNAPSHOT_NAME" \
204204
"rpool/ROOT/$CONTAINER/home" ||
205-
die "failed to create upgrade /export/home clone"
205+
die "failed to create upgrade /home clone"
206206

207207
zfs clone \
208208
-o mountpoint=legacy \
@@ -227,12 +227,32 @@ function create_upgrade_container() {
227227
# dataset.
228228
#
229229
mount_upgrade_container_dataset \
230-
"rpool/ROOT/$CONTAINER/home" "$DIRECTORY/export/home"
230+
"rpool/ROOT/$CONTAINER/home" "$DIRECTORY/home"
231231
mount_upgrade_container_dataset \
232232
"rpool/ROOT/$CONTAINER/data" "$DIRECTORY/var/delphix"
233233
mount_upgrade_container_dataset \
234234
"rpool/ROOT/$CONTAINER/log" "$DIRECTORY/var/log"
235235

236+
#
237+
# If the file has still the old owners change /etc/passwd file
238+
#
239+
passwd_file=/etc/passwd
240+
if grep -q "\/export\/home\/delphix" "$passwd_file"
241+
then
242+
usermod --home /home/delphix delphix
243+
fi
244+
245+
if grep -q "\/export\/home\/cli" "$passwd_file"
246+
then
247+
usermod --home /home/cli cli
248+
fi
249+
250+
if grep -q "\/export\/home\/cloudagent" "$passwd_file"
251+
then
252+
usermod --home /home/cloudagent cloudagent
253+
fi
254+
255+
236256
#
237257
# This function needs to return the container's name to
238258
# stdout, so that consumers of this function/script can
@@ -296,7 +316,7 @@ function create_upgrade_container() {
296316
# before the zfs-import service is run.
297317
#
298318
cat <<-EOF >"$DIRECTORY/etc/fstab"
299-
rpool/ROOT/$CONTAINER/home /export/home zfs defaults,x-systemd.before=zfs-import-cache.service 0 0
319+
rpool/ROOT/$CONTAINER/home /home zfs defaults,x-systemd.before=zfs-import-cache.service 0 0
300320
rpool/ROOT/$CONTAINER/data /var/delphix zfs defaults,x-systemd.before=zfs-import-cache.service 0 0
301321
rpool/ROOT/$CONTAINER/log /var/log zfs defaults,x-systemd.before=zfs-import-cache.service 0 0
302322
rpool/crashdump /var/crash zfs defaults,x-systemd.before=zfs-import-cache.service,x-systemd.before=kdump-tools.service 0 0

0 commit comments

Comments
 (0)