mirror of
https://github.com/YunoHost-Apps/outline_ynh.git
synced 2024-09-03 19:56:12 +02:00
Fix MinIO bucket access policy for better safety
This commit is contained in:
parent
1187226eba
commit
36eff0b786
4 changed files with 42 additions and 3 deletions
20
conf/policy.json
Normal file
20
conf/policy.json
Normal file
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"Version": "2012-10-17",
|
||||
"Statement": [
|
||||
{
|
||||
"Sid": "AllowPublicRead",
|
||||
"Effect": "Allow",
|
||||
"Principal": {
|
||||
"AWS": [
|
||||
"*"
|
||||
]
|
||||
},
|
||||
"Action": [
|
||||
"s3:GetObject"
|
||||
],
|
||||
"Resource": [
|
||||
"arn:aws:s3:::outlinestorage/public/*"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
|
@ -194,9 +194,12 @@ chown -R $app:www-data "$final_path"
|
|||
#=================================================
|
||||
ynh_script_progression --message="Setting up MinIO bucket for Outline..." --weight=1
|
||||
|
||||
ynh_add_config --template="../conf/policy.json" --destination="$mc_path/policy.json"
|
||||
|
||||
pushd "$mc_path"
|
||||
ynh_exec_warn_less sudo -u minio ./mc mb minio/outlinestorage --region "fr-ynh-1"
|
||||
ynh_exec_warn_less sudo -u minio ./mc policy set public minio/outlinestorage
|
||||
ynh_exec_warn_less sudo -u minio ./mc admin policy add minio outline ./policy.json
|
||||
ynh_exec_warn_less sudo -u minio ./mc admin policy set outline minio/outlinestorage
|
||||
popd
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -122,11 +122,15 @@ chown -R $app:www-data "$final_path"
|
|||
|
||||
mv "$final_path/outlinestorage" "$mc_path/outlinestorage"
|
||||
chown -R minio:www-data "$mc_path/outlinestorage"
|
||||
|
||||
ynh_add_config --template="../conf/policy.json" --destination="$mc_path/policy.json"
|
||||
|
||||
pushd "$mc_path"
|
||||
ynh_exec_warn_less sudo -u minio ./mc mb minio/outlinestorage --region "fr-ynh-1"
|
||||
ynh_exec_warn_less sudo -u minio ./mc policy set public minio/outlinestorage
|
||||
ynh_exec_warn_less sudo -u minio ./mc mirror --a ./outlinestorage/ minio/outlinestorage
|
||||
ynh_exec_warn_less sudo -u minio ./mc admin policy add minio outline ./policy.json
|
||||
ynh_exec_warn_less sudo -u minio ./mc admin policy set outline minio/outlinestorage
|
||||
popd
|
||||
|
||||
ynh_secure_remove --file="$mc_path/outlinestorage"
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -95,6 +95,18 @@ chmod 750 "$final_path"
|
|||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:www-data "$final_path"
|
||||
|
||||
#=================================================
|
||||
# UPDATE MINIO BUCKET
|
||||
#=================================================
|
||||
ynh_script_progression --message="Updating outlinestorage MinIO bucket access policy..." --weight=1
|
||||
|
||||
ynh_add_config --template="../conf/policy.json" --destination="$mc_path/policy.json"
|
||||
|
||||
pushd "$mc_path"
|
||||
ynh_exec_warn_less sudo -u minio ./mc admin policy add minio outline ./policy.json
|
||||
ynh_exec_warn_less sudo -u minio ./mc admin policy set outline minio/outlinestorage
|
||||
popd
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
|
Loading…
Reference in a new issue