From c642bf29fb91391dc024d25fe27280ad03a01439 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= Date: Wed, 8 Nov 2017 12:27:31 -0500 Subject: [PATCH] lxd/logs: Don't allow removing lxc.conf or lxc.log MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Those files are used by the container runtime. Signed-off-by: Stéphane Graber --- lxd/container_logs.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lxd/container_logs.go b/lxd/container_logs.go index 963283eab820..a30c6b002e30 100644 --- a/lxd/container_logs.go +++ b/lxd/container_logs.go @@ -93,6 +93,10 @@ func containerLogDelete(d *Daemon, r *http.Request) Response { return BadRequest(fmt.Errorf("log file name %s not valid", file)) } + if file == "lxc.log" || file == "lxc.conf" { + return BadRequest(fmt.Errorf("lxc.log and lxc.conf may not be deleted")) + } + return SmartError(os.Remove(shared.LogPath(name, file))) }