X-Original-To: alpine-devel@mail.alpinelinux.org Delivered-To: alpine-devel@mail.alpinelinux.org Received: from mail.alpinelinux.org (dallas-a1.alpinelinux.org [127.0.0.1]) by mail.alpinelinux.org (Postfix) with ESMTP id C0A39DC5D95 for ; Tue, 23 Feb 2016 05:13:51 +0000 (UTC) Received: from mail-pa0-f47.google.com (mail-pa0-f47.google.com [209.85.220.47]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mail.alpinelinux.org (Postfix) with ESMTPS id 8D382DC00A7 for ; Tue, 23 Feb 2016 05:13:51 +0000 (UTC) Received: by mail-pa0-f47.google.com with SMTP id fy10so103553910pac.1 for ; Mon, 22 Feb 2016 21:13:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=IM50kJOAFipRYBnkBIWKVI6b5JCKD7qDqvYCG3oCoq0=; b=C7ba2HTCb6f1iQ4QKMEZgjuZp0l6EO+6ut/4KVSHnlTqDdId4P3aWgE4p5UtyFePVS YDe6RmJc/om09+aV5wklHRePvokF1iKHLdYqoNlts/VZbmpijOW4lf3gzxSOesj8qPUv oVoWone4nP9jl3C+cbgZGjHQe7nkkXR8F3hLn3b4QfSk2rpN3JzbdKFl/llXoYIEeeIB JV032xsAe+f8x31PRZf0gCnrtaoXfHLLkUsktEA6HN2g43KwQGsqkr49fvW4ESQQPnhP NrAZnAb1qC4WpQfkhqvCT2Ojsc7SNL2O2UxZzbOYAn8YE7iqZ7lQ7pcSlumZGODZLQfp fcKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=IM50kJOAFipRYBnkBIWKVI6b5JCKD7qDqvYCG3oCoq0=; b=mFVVd2M2dmId+hteCnLsZvilxZOt6WJNNsE+h+lzuhJe9aYON3cU2QWfuD6sspqGYk IfZfWMNvz5HSubctB+ecLeZO/g9mqd0/p1EJLDTgkzlVKti77BoxOB2CIKvkWORS3ZWB zda2wdgnKnXMNG44Lan+c7ubNUpb7qBpe8bNDpvNe9yr2dv5n/s1s+IWPi2/c/c0CQ45 rgEDkpuReoSpdk4HENEX63iGvbrb4AOsSWYdDLpH11egoF17yI8WVTJuRY0QZygdJHFL mNNd5AGceQaky7oQMJMPqWdpF2izvPK3zRiLWT7u+moU4WmXSlPomHc/t8FLxW/qRIz4 v6bw== X-Gm-Message-State: AG10YOSr2L9ZTAO2B/2B2VVU3vlkecjQcX1ux9ivyDn81TXMIdx4crensfvEtGIQtSJv4w== X-Received: by 10.67.12.175 with SMTP id er15mr43290330pad.70.1456204430040; Mon, 22 Feb 2016 21:13:50 -0800 (PST) Received: from newbook ([50.0.225.136]) by smtp.gmail.com with ESMTPSA id dg1sm40730114pad.18.2016.02.22.21.13.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Feb 2016 21:13:49 -0800 (PST) Date: Mon, 22 Feb 2016 21:13:45 -0800 From: Isaac Dunham To: Alba Pompeo Cc: alpine-devel@lists.alpinelinux.org Subject: Re: [alpine-devel] What could be done to make Alpine distribution more secure Message-ID: <20160223051344.GA4173@newbook> References: X-Mailinglist: alpine-devel Precedence: list List-Id: Alpine Development List-Unsubscribe: List-Post: List-Help: List-Subscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-Virus-Scanned: ClamAV using ClamSMTP On Mon, Feb 22, 2016 at 10:16:13AM -0300, Alba Pompeo wrote: > A few days ago Linux Mint's website was hacked and their ISOs were > replaced with backdoored images. The most obvious precaution for this is -sign the images -checksum the images (ideally, sha256/sha512 and md5) -sign the checksums -include checksums and signatures in the release announcements -have a link to a separately administered archive containing the announcement; you want some place that would have to be compromised separately. (ie, if there's a gmane archive, link there) > This is a great security concern and I think a good opportunity for > Alpine Linux to rethink its distributions of ISOs and what could be > improved. > I'll start with the obvious HTTPS support. The download links on > http://www.alpinelinux.org/downloads/ all point to a HTTP link. > If you try to manually change it to HTTPS you get the message - > wiki.alpinelinux.org uses an invalid security certificate. HTTPS downloads will add to the CPU load, without preventing the typical hacks. It prevents MITM attacks when endpoint attacks are typical. Checksums and signatures should be available over HTTPS, though. (The security benefit proportional to the cost is greater.) > What else can you think about that would make alpine distribution more secure? > The most advanced security feature I've seen a few distributions doing > is reproducible builds, but it appears to be very hard and maybe not a > priority right now. But for the future maybe it could be an idea. Reproducible builds are not as hard as you'd think (says someone who spent a few years poking at Debian packages, which were almost fully reproducible before anyone got into that). The fundamental requirements are: -there must be a fully deterministic set of packages installed, if the build can vary based on installed packages. Solution: use minimal autobuilders, like Debian and Alpine do -the configuration should be overspecified, not underspecified Solution: write out the config options longhand, rather than relying on defaults. (We're partway there.) This is important for cross-compiling, anyhow. -the build options (optimization, hardening, and linker flags) must be deterministic. Solution: specify them in the build scripts and in systemwide, distro-provided config files, like Debian and Alpine do. -the build ID, if provided, should correspond to the source and options, rather than varying with the path in which it was compiled. This is just a few bytes that can vary. Solutions: (a) don't build with debug flags, since gcc encodes the path to the source in the debug information, making the object files have a variable checksum. (True of some packages, but far from all.) (b) between prepare and build, come up with a checksum based on the build options and the source code checksums. For example: BUILDID=`{ find -type f -o -type l -exec shasum '{}' + echo "$CC $CXX $CFLAGS $CXXFLAGS $CPPFLAGS $LDFLAGS } | sha512sum |cut -c -128` -there should be no way to circumvent the rules for build environment Solution: use a build server instead of package uploads, like Alpine does. In other words: Other than the build-id, it should be possible to reproduce Alpine packages. And if you set up an autobuilder per the standard directions, it should be fully reproducible. Now, as far as running from r/o media goes (another possibility that was mentioned) -this doesn't prevent hacks, but only prevents adding permanent backdoors. -this does prevent security updates without physical presence -a 'cheap' halfway measure would be bind-mounting every path that's only rarely written to over itself, but readonly. This doesn't prevent someone who has a root shell from writing, but it does prevent someone from exploiting symlink attacks or other ways of writing to arbitrary files without shell access. Example: ROPATHS="/usr /lib /bin /sbin /boot /etc /var/www/isos" for DIR in $ROPATHS; do mount -o bind,ro $DIR $DIR; done # ... do stuff ... for DIR in $ROPATHS; do umount $DIR; done apk update apk upgrade for DIR in $ROPATHS; do mount -o bind,ro $DIR $DIR; done Note that a few scripts may need adjustment to work with RO /etc. Thanks, Isaac Dunham --- Unsubscribe: alpine-devel+unsubscribe@lists.alpinelinux.org Help: alpine-devel+help@lists.alpinelinux.org ---