password-store: write secrets with read-only permission

Otherwise we are installing secrets with the wrong permissions on the
first install
This commit is contained in:
Jörg Thalheim
2024-07-22 17:21:57 +02:00
parent 7dc3a8ff2b
commit 21346f84ac

View File

@@ -113,5 +113,7 @@ class SecretStore(SecretStoreBase):
else: else:
# TODO: drop old format soon # TODO: drop old format soon
secret_name = secret secret_name = secret
(output_dir / secret_name).write_bytes(self.get(service, secret_name)) with (output_dir / secret_name).open("wb") as f:
f.chmod(0o600)
f.write(self.get(service, secret_name))
(output_dir / ".pass_info").write_bytes(self.generate_hash()) (output_dir / ".pass_info").write_bytes(self.generate_hash())