forked from 0k/0k-charms
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
991 B
37 lines
991 B
#!/bin/bash
|
|
|
|
set -eux # -x for verbose logging to juju debug-log
|
|
|
|
|
|
## ``--force-yes`` is required as kal-manage is not signed correctly.
|
|
## kal-manage provides the script /usr/lib/kal/dusk/sbin/ssh-cmd-validate
|
|
## used to validate any entrant connection to SSH.
|
|
|
|
apt-get install -y --force-yes rsync kal-manage
|
|
|
|
|
|
mkdir -p /var/mirror
|
|
mkdir -p /var/lib/rsync
|
|
|
|
groupadd -r rsync
|
|
useradd -r rsync -d /var/lib/rsync -g rsync
|
|
|
|
chown rsync:rsync /var/lib/rsync
|
|
|
|
su -c 'ssh-keygen -t rsa -N "" -f ~/.ssh/id_rsa -q' - rsync
|
|
|
|
## /etc/sudoers
|
|
cat <<EOF >> /etc/sudoers
|
|
|
|
## allow rsync to access /var/mirror
|
|
|
|
rsync ALL=(root) NOPASSWD: /usr/bin/rsync --server -vlogDtprRz --delete . /var/mirror/*
|
|
rsync ALL=(root) NOPASSWD: /usr/bin/rsync --server -vlogDtprRze.iLs --delete . /var/mirror/*
|
|
rsync ALL=(root) NOPASSWD: /usr/bin/rsync --server -vlogDtprRze.iLsf --delete . /var/mirror/*
|
|
rsync ALL=(root) NOPASSWD: /usr/bin/rsync --server -vlogDtprRze.iLsf --bwlimit=200 --delete . /var/mirror/*
|
|
|
|
EOF
|
|
|
|
|
|
|
|
|