server: fix setuid/guid

This commit is contained in:
2026-04-13 20:00:00 +02:00
parent f100998d09
commit 23f767a866
3 changed files with 12 additions and 12 deletions
+6 -6
View File
@@ -207,7 +207,7 @@ func (srv *Server) Build() error {
return err
}
rundir := filepath.Dir(srv.conf.Runpath)
srv.logg.Infof("Creating run directory %s", rundir)
//srv.logg.Infof("Creating run directory %s", rundir)
err = os.MkdirAll(rundir, 0750)
if err != nil {
return err
@@ -259,7 +259,6 @@ func (srv *Server) Build() error {
if err != nil {
return err
}
cert, key := []byte(srv.conf.X509Cert), []byte(srv.conf.X509Key)
addrinfo := fmt.Sprintf("%s:%d", srv.conf.Service.Address, srv.conf.Service.Port)
listener, err := CreateTLSListener(addrinfo, cert, key)
@@ -270,15 +269,16 @@ func (srv *Server) Build() error {
if cuid64 == 0 {
// Change effective user and group
err = syscall.Setuid(euid)
if err != nil {
return err
}
err = syscall.Setgid(egid)
if err != nil {
return err
}
err = syscall.Setuid(euid)
if err != nil {
return err
}
}
//return fmt.Errorf("Debug break")
uidstr := strconv.FormatInt(int64(syscall.Geteuid()), 10)
usr, err := user.LookupId(uidstr)
+5 -5
View File
@@ -26,12 +26,12 @@ spec:
volumeMounts:
- name: config-volume
mountPath: /app/etc/mstore
- name: db-volume
mountPath: /var/lib
# - name: db-volume
# mountPath: /var/lib
volumes:
- name: config-volume
configMap:
name: mstored-config
- name: db-volume
persistentVolumeClaim:
claimName: mstore-data
# - name: db-volume
# persistentVolumeClaim:
# claimName: mstore-data
+1 -1
View File
@@ -1,6 +1,6 @@
main:
image:
path: hub.unix7.org/mstore
path: t14x.unix7.org/mstore
name: "@PACKAGE_NAME@"
tag: "@PACKAGE_VERSION@"
imagePullPolicy: Always