Skip to content

Commit 3a5a58c

Browse files
committed
Run portlayer as un-privileged user
Start portlayer process with vicadmin user and give cap_sys_admin capability to it.
1 parent 6b4310f commit 3a5a58c

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

isos/appliance.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,9 @@ cp ${BIN}/vic-init $(rootfs_dir $PKGDIR)/sbin/vic-init
127127
cp ${BIN}/{docker-engine-server,port-layer-server,vicadmin} $(rootfs_dir $PKGDIR)/sbin/
128128
cp ${BIN}/unpack $(rootfs_dir $PKGDIR)/bin/
129129

130+
# give port-layer-server privilege to mount image disks
131+
chroot $(rootfs_dir $PKGDIR) setcap cap_sys_admin=+ep /sbin/port-layer-server
132+
130133
# Generate the ISO
131134
# Select systemd for our init process
132135
generate_iso $PKGDIR $BIN/appliance.iso /lib/systemd/systemd

lib/install/management/appliance.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -673,6 +673,8 @@ func (d *Dispatcher) createAppliance(conf *config.VirtualContainerHostConfigSpec
673673
)
674674

675675
cfg := &executor.SessionConfig{
676+
User: "vicadmin",
677+
Group: "vicadmin",
676678
Cmd: executor.Cmd{
677679
Path: "/sbin/port-layer-server",
678680
Args: []string{

0 commit comments

Comments
 (0)