Previous: Configuração de descarregamento de daemon, Up: Configurando o daemon [Contents][Index]
O Guix inclui um arquivo de políticas do SELinux em etc/guix-daemon.cil que pode ser instalado em um sistema em que o SELinux está ativado, para rotular os arquivos do Guix e especificar o comportamento esperado do daemon. Como o Guix System não fornece uma política básica do SELinux, a política do daemon não pode ser usada no Guix System.
Para instalar a política, execute esse comando como root:
semodule -i etc/guix-daemon.cil
Then relabel the file system with restorecon -vR /
or by a different
mechanism provided by your system. You may need to remount
/gnu/store to make it writable first, e.g. with mount -o
remount,rw /gnu/store
.
Depois que a política é instalada, o sistema de arquivos foi rotulado
novamente e o daemon foi reiniciado, ele deve estar em execução no contexto
guix_daemon_t
. Você pode confirmar isso com o seguinte comando:
ps -Zax | grep guix-daemon
Monitore os arquivos de log do SELinux enquanto executa um comando como
guix build hello
para se convencer de que o SELinux permite todas as
operações necessárias.
Esta política não é perfeita. Aqui está uma lista de limitações ou peculiaridades que devem ser consideradas ao implementar a política SELinux fornecida para o daemon Guix.
guix_daemon_socket_t
isn’t actually used. None of the socket
operations involve contexts that have anything to do with
guix_daemon_socket_t
. It doesn’t hurt to have this unused label, but
it would be preferable to define socket rules for only this label.
guix gc
cannot access arbitrary links to profiles. By design, the
file label of the destination of a symlink is independent of the file label
of the link itself. Although all profiles under $localstatedir are
labelled, the links to these profiles inherit the label of the directory
they are in. For links in the user’s home directory this will be
user_home_t
. But for links from the root user’s home directory, or
/tmp, or the HTTP server’s working directory, etc, this won’t work.
guix gc
would be prevented from reading and following these links.
/gnu/store/.+-(guix-.+|profile)/bin/guix-daemon
recebem o rótulo
guix_daemon_exec_t
; isso significa que qualquer arquivo com
esse nome em qualquer perfil poderá ser executado no domínio de
guix_daemon_t
. Isto não é o ideal. Um invasor pode criar um pacote
que forneça esse executável e convencer um usuário a instalar e executá-lo,
o que o eleva ao domínio de guix_daemon_t
. Nesse ponto, o SELinux não
poderia impedir o acesso a arquivos permitidos para processos nesse domínio.
You will need to relabel the store directory after all upgrades to
guix-daemon, such as after running guix pull
. Assuming the
store is in /gnu, you can do this with restorecon -vR /gnu
, or
by other means provided by your operating system.
Poderíamos gerar uma política muito mais restritiva no momento da
instalação, para que apenas o nome do arquivo exato do executável
guix-daemon
atualmente instalado seja rotulado com
guix_daemon_exec_t
, em vez de usar um amplo expressão regular. A
desvantagem é que o root precisaria instalar ou atualizar a política no
momento da instalação sempre que o pacote Guix que fornece o executável
guix-daemon
em execução efetiva for atualizado.
Previous: Configuração de descarregamento de daemon, Up: Configurando o daemon [Contents][Index]