Fix: /var/cache/distfiles writable by everyone (#1329)

As noted in commit 255c715624
`/var/cache/distfiles` is writable by everyone. It is supposed to be
writable only by `root` and by the `abuild` group (in which we put the
`pmos` user already for building packages).

Changes:
* `pmb.build.init()`: make `/var/cache/distfiles` writable only by
  members of the `abuild` group (and root)
* Increase workfolder version to 2
* Add migration code that fixes the permissions for existing work
  folders
* Refactor the migration code a bit to make this possible
This commit is contained in:
Oliver Smith 2018-03-30 21:46:31 +00:00 committed by GitHub
parent 40db17d775
commit 4d8afc4aa5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 42 additions and 17 deletions

View file

@ -57,7 +57,7 @@ def ask_for_work_path(args):
if not os.path.exists(ret):
os.makedirs(ret, 0o700, True)
with open(ret + "/version", "w") as handle:
handle.write(pmb.config.work_version + "\n")
handle.write(str(pmb.config.work_version) + "\n")
# Make sure, that we can write into it
os.makedirs(ret + "/cache_http", 0o700, True)