Merge pull request #10 from arillso/use-regex-escape

Escape Restic Password correctly
This commit is contained in:
Matthias Leutenegger 2020-06-04 19:23:31 +02:00 committed by GitHub
commit 700853b170
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 4 deletions

View file

@ -4,6 +4,9 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
and [human-readable changelog](https://keepachangelog.com/en/1.0.0/).
## Unreleased
### Changed
* Password now use `regex_escape()` filter in templates
## [0.2.5] - 2020-06-02
### Fixed:
* AWS credentials are now supplied to the initialising step

View file

@ -4,12 +4,12 @@
# Source this file to work with restic on this host
export RESTIC_REPOSITORY={{ restic_repos[item.repo].location }}
export RESTIC_PASSWORD={{ restic_repos[item.repo].password }}
export RESTIC_PASSWORD='{{ restic_repos[item.repo].password | regex_replace('\'', '\'\\\'\'') }}'
{% if restic_repos[item.repo].aws_access_key is defined %}
export AWS_ACCESS_KEY_ID={{ restic_repos[item.repo].aws_access_key }}
{% endif %}
{% if restic_repos[item.repo].aws_secret_access_key is defined %}
export AWS_SECRET_ACCESS_KEY={{ restic_repos[item.repo].aws_secret_access_key }}
export AWS_SECRET_ACCESS_KEY='{{ restic_repos[item.repo].aws_secret_access_key | regex_replace('\'', '\'\\\'\'') }}'
{% endif %}
{% if restic_repos[item.repo].aws_default_region is defined %}
export AWS_DEFAULT_REGION={{ restic_repos[item.repo].aws_default_region }}

View file

@ -4,13 +4,13 @@
# Use this file to create a Backup and prune existing data with one execution.
export RESTIC_REPOSITORY={{ restic_repos[item.repo].location }}
export RESTIC_PASSWORD={{ restic_repos[item.repo].password }}
export RESTIC_PASSWORD='{{ restic_repos[item.repo].password | regex_replace('\'', '\'\\\'\'') }}'
BACKUP_NAME={{ item.name }}
{% if restic_repos[item.repo].aws_access_key is defined %}
export AWS_ACCESS_KEY_ID={{ restic_repos[item.repo].aws_access_key }}
{% endif %}
{% if restic_repos[item.repo].aws_secret_access_key is defined %}
export AWS_SECRET_ACCESS_KEY={{ restic_repos[item.repo].aws_secret_access_key }}
export AWS_SECRET_ACCESS_KEY='{{ restic_repos[item.repo].aws_secret_access_key | regex_replace('\'', '\'\\\'\'') }}'
{% endif %}
{% if restic_repos[item.repo].aws_default_region is defined %}
export AWS_DEFAULT_REGION={{ restic_repos[item.repo].aws_default_region }}