services: urandom-seed: Set umask to 077 while shutting down.

* gnu/services/base.scm (urandom-seed-shepherd-service): Call 'umask'.
This commit is contained in:
Leo Famulari 2016-05-29 11:13:59 -04:00
parent df2dd07b88
commit 8fe5d95e66
No known key found for this signature in database
GPG Key ID: 2646FA30BACA7F08
1 changed files with 6 additions and 4 deletions

View File

@ -460,10 +460,12 @@ stopped before 'kill' is called."
(let ((buf (make-bytevector 512))) (let ((buf (make-bytevector 512)))
(call-with-input-file "/dev/urandom" (call-with-input-file "/dev/urandom"
(lambda (urandom) (lambda (urandom)
(get-bytevector-n! urandom buf 0 512) (let ((previous-umask (umask #o077)))
(call-with-output-file #$%random-seed-file (get-bytevector-n! urandom buf 0 512)
(lambda (seed) (call-with-output-file #$%random-seed-file
(put-bytevector seed buf))) (lambda (seed)
(put-bytevector seed buf)))
(umask previous-umask))
#t))))) #t)))))
(modules `((rnrs bytevectors) (modules `((rnrs bytevectors)
(rnrs io ports) (rnrs io ports)