Skip to content

Instantly share code, notes, and snippets.

@jwreagor
Created October 6, 2017 03:53
Show Gist options
  • Save jwreagor/397c56f5c1a84b4ca864e559e69ea996 to your computer and use it in GitHub Desktop.
Save jwreagor/397c56f5c1a84b4ca864e559e69ea996 to your computer and use it in GitHub Desktop.
Manta policy example
# Create backup user/policies (usage: make manta [email protected] PASSWORD=pwd)
# -------------------------------------------------------
# Create user and policies for backups
# Requires SDC_ACCOUNT to be set
# usage:
# make manta [email protected] PASSWORD=strongpassword
#
## Create backup user and policies
manta:
$(call check_var, EMAIL PASSWORD SDC_ACCOUNT, \
Required to create a Manta login.)
ssh-keygen -t rsa -b 4096 -C "${EMAIL}" -f manta
sdc-user create --login=${MANTA_LOGIN} --password=${PASSWORD} --email=${EMAIL}
sdc-user upload-key $(ssh-keygen -E md5 -lf ./manta | awk -F' ' '{gsub("MD5:","");{print $2}}') --name=${MANTA_LOGIN}-key ${MANTA_LOGIN} ./manta.pub
sdc-policy create --name=${MANTA_POLICY} \
--rules='CAN getobject' \
--rules='CAN putobject' \
--rules='CAN putmetadata' \
--rules='CAN putsnaplink' \
--rules='CAN getdirectory' \
--rules='CAN putdirectory'
sdc-role create --name=${MANTA_ROLE} \
--policies=${MANTA_POLICY} \
--members=${MANTA_LOGIN}
mmkdir ${SDC_ACCOUNT}/stor/${MANTA_LOGIN}
mchmod -- +triton_redis /${SDC_ACCOUNT}/stor/${MANTA_LOGIN}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment