Automatically set permissions

This commit is contained in:
Héctor Molinero Fernández 2020-02-06 20:06:08 +01:00
parent 082c6290e1
commit 699069ef79

View File

@ -5,8 +5,8 @@ build {
provisioner "file" { provisioner "file" {
direction = "upload" direction = "upload"
source = "./rootfs/" source = "./rootfs"
destination = "/" destination = "/tmp"
} }
provisioner "shell" { provisioner "shell" {
@ -17,14 +17,11 @@ build {
inline_shebang = "/bin/sh -eux" inline_shebang = "/bin/sh -eux"
inline = [ inline = [
<<EOF <<EOF
chmod 644 /etc/apt/apt.conf.d/20auto-upgrades find /tmp/rootfs/ -type d -exec chmod 755 '{}' ';' -exec chown root:root '{}' ';'
chmod 644 /etc/apt/apt.conf.d/50unattended-upgrades find /tmp/rootfs/ -type f -exec chmod 644 '{}' ';' -exec chown root:root '{}' ';'
chmod 644 /etc/fail2ban/jail.d/sshd.conf find /tmp/rootfs/ -type f -regex '.+/\(bin\|cron\..+\)/.+' -exec chmod 755 '{}' ';'
chmod 644 /etc/ssh/sshd_config find /tmp/rootfs/ -mindepth 1 -maxdepth 1 -exec cp -rfla '{}' / ';'
chmod 644 /etc/unbound/unbound.conf rm -rf /tmp/rootfs/
chmod 644 /etc/wireguard/client-sample.conf
chmod 644 /etc/wireguard/wg0-peers.conf
chmod 600 /etc/wireguard/wg0.conf
EOF EOF
, ,
<<EOF <<EOF