[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#54997] [PATCH 09/12] services: ipfs: Use 'least-authority-wrapper'.
From: |
Maxime Devos |
Subject: |
[bug#54997] [PATCH 09/12] services: ipfs: Use 'least-authority-wrapper'. |
Date: |
Mon, 18 Apr 2022 11:08:02 +0200 |
User-agent: |
Evolution 3.38.3-1 |
Ludovic Courtès schreef op zo 17-04-2022 om 23:04 [+0200]:
> [...]
>
> (define (ipfs-binary config)
> - (file-append (ipfs-configuration-package config) "/bin/ipfs"))
> + (define command
> + (file-append (ipfs-configuration-package config) "/bin/ipfs"))
> +
> + (least-authority-wrapper
> + command
> + #:name "ipfs"
> + #:mappings (list %ipfs-home-mapping)
> + #:namespaces (delq 'net %namespaces)))
To simplify things later, could #:user "ipfs" and #:group "ipfs" be
added to the least-authority wrapper (and implemented in the 'least-
authority procedre)? Then ...
> + (define (exec-command . args)
> + ;; Exec the given ifps command with the right authority.
> + #~(let ((pid (primitive-fork)))
> + (if (zero? pid)
> + (dynamic-wind
> + (const #t)
> + (lambda ()
> + ;; Run ipfs init and ipfs config from a container,
> + ;; in case the IPFS daemon was compromised at some
point
> + ;; and ~/.ipfs is now a symlink to somewhere outside
> + ;; %ipfs-home.
> + (let ((pw (getpwnam "ipfs")))
> + (setgroups '#())
> + (setgid (passwd:gid pw))
> + (setuid (passwd:uid pw))
> + (environ #$%ipfs-environment)
> + (execl #$(ipfs-binary config) #$@args)))
> + (lambda ()
> + (primitive-exit 127)))
> + (waitpid pid))))
would become simpler as it wouldn't need to fork, exec, waitpid and
dynamic-wind. Alternatively, if associating a user and group with a
pola wrapper is problematic (*), what do you think of defining a
'system*/with-capabilities' or 'invoke/with-capabilities' in a central
location?
Greetings,
Maxime.
signature.asc
Description: This is a digitally signed message part
- [bug#54997] [PATCH 07/12] services: bitlbee: Use 'make-inetd-constructor'., (continued)
[bug#54997] [PATCH 10/12] services: wesnothd: Grant write access to /var/run/wesnothd., Ludovic Courtès, 2022/04/17
[bug#54997] [PATCH 11/12] services: wesnothd: Use 'least-authority-wrapper'., Ludovic Courtès, 2022/04/17
[bug#54997] [PATCH 12/12] services: quassel: Use 'least-authority-wrapper'., Ludovic Courtès, 2022/04/17
[bug#54997] [PATCH 06/12] services: dicod: Use 'make-inetd-constructor'., Ludovic Courtès, 2022/04/17
[bug#54997] [PATCH 08/12] services: ipfs: Adjust for Shepherd 0.9., Ludovic Courtès, 2022/04/17
[bug#54997] [PATCH 09/12] services: ipfs: Use 'least-authority-wrapper'., Ludovic Courtès, 2022/04/17
- [bug#54997] [PATCH 09/12] services: ipfs: Use 'least-authority-wrapper'.,
Maxime Devos <=
- [bug#54997] [PATCH 00/12] Add "least authority" program wrapper, Ludovic Courtès, 2022/04/19
- [bug#54997] [PATCH 00/12] Add "least authority" program wrapper, Maxime Devos, 2022/04/22
- [bug#54997] [PATCH 00/12] Add "least authority" program wrapper, Ludovic Courtès, 2022/04/27
- [bug#54997] [PATCH 00/12] Add "least authority" program wrapper, Maxime Devos, 2022/04/28
- [bug#54997] [PATCH 00/12] Add "least authority" program wrapper, Ludovic Courtès, 2022/04/28
- [bug#54997] [PATCH 00/12] Add "least authority" program wrapper, Maxime Devos, 2022/04/28
[bug#54997] [PATCH 01/12] gexp: Add 'references-file'., Thiago Jung Bauermann, 2022/04/22
[bug#54997] [PATCH 00/12] Add "least authority" program wrapper, Maxime Devos, 2022/04/22