Merge pull request 'Feat/rights from file' (#2) from feat/rights-from-file into main

Reviewed-on: #2
This commit was merged in pull request #2.
This commit is contained in:
pulsar committed 2026-11-08 16:46:57 +00:00
commit 195f941460
5 files changed
+54

No files matched your search

+25
View File
@@ -8,3 +8,28 @@ radicale_users: []
# Example:
# - name: toto
# password: <secret>
# password is either the plain-text password, hashed at deploy time (SHA-512
# crypt, stable per-user salt so the file stays idempotent), or an existing
# htpasswd hash ($apr1$, bcrypt $2y$, $5$, $6$, argon2), written as is.
# Access rights. Empty: built-in "owner_only" model. Otherwise a rights file is
# deployed and used ("from_file"); sections are evaluated in order, the first
# matching one wins. See https://radicale.org/v3.html#authorization-and-rights
radicale_rights: []
# Example (same as owner_only, plus anonymous GET on one calendar):
# - name: root
# user: ".+"
# collection: ""
# permissions: R
# - name: principal
# user: ".+"
# collection: "{user}"
# permissions: RW
# - name: calendars
# user: ".+"
# collection: "{user}/[^/]+"
# permissions: rw
# - name: public
# user: ".*"
# collection: "toto/public"
# permissions: i
+12
View File
@@ -50,6 +50,7 @@
group: "{{ radicale_user }}"
mode: u=rw,g=r,o=
become: true
diff: false
notify: Restart radicale.service
- name: Deploy configuration file
@@ -61,3 +62,14 @@
mode: u=rw,g=r,o=
become: true
notify: Restart radicale.service
- name: Deploy rights file
ansible.builtin.template:
src: rights.j2
dest: "{{ radicale_root_path }}/rights"
owner: root
group: "{{ radicale_user }}"
mode: u=rw,g=r,o=
become: true
when: radicale_rights | length > 0
notify: Restart radicale.service
+5
View File
@@ -12,7 +12,12 @@ stock=utf-8
level=debug
[rights]
{% if radicale_rights | length > 0 %}
type=from_file
file={{ radicale_root_path }}/rights
{% else %}
type=owner_only
{% endif %}
[server]
hosts=0.0.0.0:5232, [::]:5232
+8
View File
@@ -0,0 +1,8 @@
# {{ ansible_managed }}
{% for rule in radicale_rights %}
[{{ rule.name }}]
user: {{ rule.user }}
collection: {{ rule.collection }}
permissions: {{ rule.permissions }}
{% endfor %}
+4
View File
@@ -1,5 +1,9 @@
# {{ ansible_managed }}
{% for user in radicale_users %}
{% if user.password is match('^\$(apr1|2[abxy]?|argon2(i|d|id)|5|6)\$') %}
{{ user.name }}:{{ user.password }}
{% else %}
{{ user.name }}:{{ user.password | password_hash('sha512', ((user.name ~ '@' ~ inventory_hostname) | hash('sha256'))[:16]) }}
{% endif %}
{% endfor %}