Compare commits
14 commits
temp-20251
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f647e15aee | ||
|
|
53b88c896f | ||
|
|
4bb1c0d1be | ||
|
|
c2e100b1aa | ||
|
|
6294edaa59 | ||
|
|
88a65ad919 | ||
|
|
5b283c7804 | ||
|
|
df9f32ad02 | ||
|
|
59510fb415 | ||
|
|
e0f485e556 | ||
|
|
fb931da668 | ||
|
|
5d1b1908a5 | ||
|
|
283b8d9863 | ||
|
|
03a84c0d6a |
24
roles/authelia-and-nginx/cfg.schema.json
Normal file
24
roles/authelia-and-nginx/cfg.schema.json
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
"nullable": false,
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"domain": {
|
||||
"nullable": false,
|
||||
"type": "string"
|
||||
},
|
||||
"tls_mode": {
|
||||
"nullable": false,
|
||||
"type": "string",
|
||||
"options": [
|
||||
"disable",
|
||||
"enable",
|
||||
"force"
|
||||
],
|
||||
"enum": "force"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"domain"
|
||||
]
|
||||
}
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"var_authelia_and_nginx_domain": "authelia.example.org",
|
||||
"var_authelia_and_nginx_tls_mode": "force"
|
||||
"cfg_authelia_and_nginx_defaults": {
|
||||
"tls_mode": "force"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,11 @@
|
|||
[
|
||||
{
|
||||
"name": "show vars",
|
||||
"when": "switch_show_vars",
|
||||
"ansible.builtin.debug": {
|
||||
"var": "vars.cfg_authelia_and_nginx"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "deactivate default site",
|
||||
"become": true,
|
||||
|
|
@ -12,7 +19,7 @@
|
|||
"become": true,
|
||||
"ansible.builtin.template": {
|
||||
"src": "conf.j2",
|
||||
"dest": "/etc/nginx/sites-available/{{var_authelia_and_nginx_domain}}"
|
||||
"dest": "/etc/nginx/sites-available/{{cfg_authelia_and_nginx.domain}}"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
@ -20,8 +27,8 @@
|
|||
"become": true,
|
||||
"ansible.builtin.file": {
|
||||
"state": "link",
|
||||
"src": "/etc/nginx/sites-available/{{var_authelia_and_nginx_domain}}",
|
||||
"dest": "/etc/nginx/sites-enabled/{{var_authelia_and_nginx_domain}}"
|
||||
"src": "/etc/nginx/sites-available/{{cfg_authelia_and_nginx.domain}}",
|
||||
"dest": "/etc/nginx/sites-enabled/{{cfg_authelia_and_nginx.domain}}"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -45,27 +45,27 @@
|
|||
{% endmacro %}
|
||||
|
||||
server {
|
||||
server_name {{var_authelia_and_nginx_domain}};
|
||||
server_name {{cfg_authelia_and_nginx.domain}};
|
||||
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
|
||||
{% if (var_authelia_and_nginx_tls_mode == 'force') %}
|
||||
{% if (cfg_authelia_and_nginx.tls_mode == 'force') %}
|
||||
return 301 https://$http_host$request_uri;
|
||||
{% else %}
|
||||
{{ authelia_common() }}
|
||||
{% endif %}
|
||||
}
|
||||
|
||||
{% if (var_authelia_and_nginx_tls_mode != 'disable') %}
|
||||
{% if (cfg_authelia_and_nginx.tls_mode != 'disable') %}
|
||||
server {
|
||||
server_name {{var_authelia_and_nginx_domain}};
|
||||
server_name {{cfg_authelia_and_nginx.domain}};
|
||||
|
||||
listen [::]:443 ssl http2;
|
||||
listen 443 ssl http2;
|
||||
|
||||
ssl_certificate_key /etc/ssl/private/{{var_authelia_and_nginx_domain}}.pem;
|
||||
ssl_certificate /etc/ssl/fullchains/{{var_authelia_and_nginx_domain}}.pem;
|
||||
ssl_certificate_key /etc/ssl/private/{{cfg_authelia_and_nginx.domain}}.pem;
|
||||
ssl_certificate /etc/ssl/fullchains/{{cfg_authelia_and_nginx.domain}}.pem;
|
||||
include /etc/nginx/ssl-hardening.conf;
|
||||
|
||||
{{ authelia_common() }}
|
||||
|
|
|
|||
|
|
@ -1,15 +0,0 @@
|
|||
{
|
||||
"domain": {
|
||||
"type": "string",
|
||||
"mandatory": false
|
||||
},
|
||||
"tls_mode": {
|
||||
"type": "string",
|
||||
"options": [
|
||||
"disable",
|
||||
"enable",
|
||||
"force"
|
||||
],
|
||||
"mandatory": false
|
||||
}
|
||||
}
|
||||
25
roles/authelia-for-hedgedoc/cfg.schema.json
Normal file
25
roles/authelia-for-hedgedoc/cfg.schema.json
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
"nullable": false,
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"hedgedoc_url_base": {
|
||||
"nullable": false,
|
||||
"type": "string"
|
||||
},
|
||||
"client_id": {
|
||||
"nullable": false,
|
||||
"type": "string",
|
||||
"default": "hedgedoc"
|
||||
},
|
||||
"client_secret": {
|
||||
"nullable": false,
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"hedgedoc_url_base",
|
||||
"client_id",
|
||||
"client_secret"
|
||||
]
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"var_authelia_for_hedgedoc_hedgedoc_url_base": "https://hedgedoc.example.org",
|
||||
"var_authelia_for_hedgedoc_client_id": "hedgedoc",
|
||||
"var_authelia_for_hedgedoc_client_secret": "REPLACE_ME"
|
||||
"cfg_authelia_for_hedgedoc_defaults": {
|
||||
"client_id": "hedgedoc"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,16 @@
|
|||
[
|
||||
{
|
||||
"name": "show vars",
|
||||
"when": "switch_show_vars",
|
||||
"ansible.builtin.debug": {
|
||||
"var": "vars.cfg_authelia_for_hedgedoc"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "configuration | compute client secret hash",
|
||||
"become": true,
|
||||
"ansible.builtin.shell": {
|
||||
"cmd": "authelia crypto hash generate bcrypt --password {{var_authelia_for_hedgedoc_client_secret}} | cut --delimiter=' ' --fields='2-'"
|
||||
"cmd": "authelia crypto hash generate bcrypt --password {{cfg_authelia_for_hedgedoc.client_secret}} | cut --delimiter=' ' --fields='2-'"
|
||||
},
|
||||
"register": "temp_authelia_for_hedgedoc_client_secret_hashed"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"client_id": "{{var_authelia_for_hedgedoc_client_id}}",
|
||||
"client_id": "{{cfg_authelia_for_hedgedoc.client_id}}",
|
||||
"client_secret": "{{temp_authelia_for_hedgedoc_client_secret_hashed.stdout}}",
|
||||
"client_name": "Hedgedoc",
|
||||
"public": false,
|
||||
|
|
@ -10,7 +10,7 @@
|
|||
"profile"
|
||||
],
|
||||
"redirect_uris": [
|
||||
"{{var_authelia_for_hedgedoc_hedgedoc_url_base}}/auth/oauth2/callback"
|
||||
"{{cfg_authelia_for_hedgedoc.hedgedoc_url_base}}/auth/oauth2/callback"
|
||||
],
|
||||
"response_types": [
|
||||
"code"
|
||||
|
|
|
|||
|
|
@ -4,8 +4,7 @@
|
|||
"properties": {
|
||||
"owncloud_url_base": {
|
||||
"nullable": false,
|
||||
"type": "string",
|
||||
"default": "https://owncloud.example.org"
|
||||
"type": "string"
|
||||
},
|
||||
"web": {
|
||||
"nullable": true,
|
||||
|
|
@ -69,12 +68,12 @@
|
|||
"nullable": true,
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"ios_client_id": {
|
||||
"client_id": {
|
||||
"nullable": false,
|
||||
"type": "string",
|
||||
"default": "mxd5OQDk6es5LzOzRvidJNfXLUZS2oN3oUFeXPP8LpPrhx3UroJFduGEYIBOxkY1"
|
||||
},
|
||||
"ios_client_secret": {
|
||||
"client_secret": {
|
||||
"nullable": false,
|
||||
"type": "string",
|
||||
"default": "KFeFWWEZO9TkisIQzR3fo7hfiMXlOpaqP8CFuTbSHzV1TUuGECglPxpiVKJfOXIx"
|
||||
|
|
@ -89,5 +88,10 @@
|
|||
},
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"owncloud_url_base",
|
||||
"web",
|
||||
"desktop",
|
||||
"android",
|
||||
"ios"
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
{
|
||||
"cfg_authelia_for_owncloud_defaults": {
|
||||
"owncloud_url_base": "https://owncloud.example.org",
|
||||
"web": {
|
||||
"client_id": "owncloud_web"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
"client_id": "{{cfg_authelia_for_owncloud.android.client_id}}",
|
||||
"client_secret": "{{temp_authelia_for_owncloud_android_client_secret_hashed.stdout}}",
|
||||
"client_name": "ownCloud | Android Client",
|
||||
|
||||
|
||||
"public": false,
|
||||
"authorization_policy": "one_factor",
|
||||
"require_pkce": true,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
"client_id": "{{cfg_authelia_for_owncloud.desktop.client_id}}",
|
||||
"client_secret": "{{temp_authelia_for_owncloud_desktop_client_secret_hashed.stdout}}",
|
||||
"client_name": "ownCloud | Desktop Client",
|
||||
|
||||
|
||||
"public": false,
|
||||
"authorization_policy": "one_factor",
|
||||
"require_pkce": true,
|
||||
|
|
|
|||
|
|
@ -7,10 +7,30 @@
|
|||
"type": "string",
|
||||
"default": "0.0.0.0"
|
||||
},
|
||||
"domain": {
|
||||
"nullable": false,
|
||||
"type": "string"
|
||||
},
|
||||
"session_domain": {
|
||||
"nullable": false,
|
||||
"type": "string"
|
||||
},
|
||||
"redirect_url": {
|
||||
"nullable": false,
|
||||
"type": "string"
|
||||
},
|
||||
"jwt_secret": {
|
||||
"nullable": false,
|
||||
"type": "string"
|
||||
},
|
||||
"session_secret": {
|
||||
"nullable": false,
|
||||
"type": "string"
|
||||
},
|
||||
"storage_encryption_key": {
|
||||
"nullable": false,
|
||||
"type": "string"
|
||||
},
|
||||
"users_file_path": {
|
||||
"nullable": false,
|
||||
"type": "string",
|
||||
|
|
@ -21,29 +41,6 @@
|
|||
"type": "string",
|
||||
"default": "/var/authelia/log.jsonl"
|
||||
},
|
||||
"domain": {
|
||||
"nullable": false,
|
||||
"type": "string",
|
||||
"default": "authelia.example.org"
|
||||
},
|
||||
"redirect_url": {
|
||||
"nullable": false,
|
||||
"type": "string",
|
||||
"default": "https://example.org"
|
||||
},
|
||||
"session_domain": {
|
||||
"nullable": false,
|
||||
"type": "string",
|
||||
"default": "example.org"
|
||||
},
|
||||
"session_secret": {
|
||||
"nullable": false,
|
||||
"type": "string"
|
||||
},
|
||||
"storage_encryption_key": {
|
||||
"nullable": false,
|
||||
"type": "string"
|
||||
},
|
||||
"storage": {
|
||||
"anyOf": [
|
||||
{
|
||||
|
|
@ -53,7 +50,8 @@
|
|||
"kind": {
|
||||
"nullable": false,
|
||||
"type": "string",
|
||||
"enum": ["sqlite"]
|
||||
"enum": ["sqlite"],
|
||||
"default": "sqlite"
|
||||
},
|
||||
"data": {
|
||||
"nullable": false,
|
||||
|
|
@ -67,6 +65,7 @@
|
|||
},
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"path"
|
||||
],
|
||||
"default": {
|
||||
}
|
||||
|
|
@ -74,8 +73,11 @@
|
|||
},
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"kind"
|
||||
]
|
||||
"kind",
|
||||
"data"
|
||||
],
|
||||
"default": {
|
||||
}
|
||||
},
|
||||
{
|
||||
"nullable": false,
|
||||
|
|
@ -117,15 +119,23 @@
|
|||
},
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"password"
|
||||
]
|
||||
"host",
|
||||
"port",
|
||||
"username",
|
||||
"password",
|
||||
"schema"
|
||||
],
|
||||
"default": {
|
||||
}
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"kind",
|
||||
"data"
|
||||
]
|
||||
],
|
||||
"default": {
|
||||
}
|
||||
},
|
||||
{
|
||||
"nullable": false,
|
||||
|
|
@ -167,22 +177,30 @@
|
|||
},
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"password"
|
||||
]
|
||||
"host",
|
||||
"port",
|
||||
"username",
|
||||
"password",
|
||||
"schema"
|
||||
],
|
||||
"default": {
|
||||
}
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"kind",
|
||||
"data"
|
||||
]
|
||||
],
|
||||
"default": {
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"ntp_server": {
|
||||
"nullable": false,
|
||||
"type": "string",
|
||||
"mandatory": false
|
||||
"default": "time.cloudflare.com:123"
|
||||
},
|
||||
"password_reset": {
|
||||
"nullable": false,
|
||||
|
|
@ -201,6 +219,8 @@
|
|||
},
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"enabled",
|
||||
"custom_url"
|
||||
],
|
||||
"default": {
|
||||
}
|
||||
|
|
@ -214,15 +234,22 @@
|
|||
"kind": {
|
||||
"nullable": false,
|
||||
"type": "string",
|
||||
"enum": ["file"]
|
||||
"enum": ["file"],
|
||||
"default": "file"
|
||||
},
|
||||
"data": {
|
||||
"nullable": false,
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"path": {
|
||||
"nullable": false,
|
||||
"type": "string",
|
||||
"default": "/var/authelia/notifications"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"path"
|
||||
],
|
||||
"default": {
|
||||
}
|
||||
|
|
@ -230,8 +257,11 @@
|
|||
},
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"kind"
|
||||
]
|
||||
"kind",
|
||||
"data"
|
||||
],
|
||||
"default": {
|
||||
}
|
||||
},
|
||||
{
|
||||
"nullable": false,
|
||||
|
|
@ -240,7 +270,8 @@
|
|||
"kind": {
|
||||
"nullable": false,
|
||||
"type": "string",
|
||||
"enum": ["smtp"]
|
||||
"enum": ["smtp"],
|
||||
"default": "smtp"
|
||||
},
|
||||
"data": {
|
||||
"nullable": false,
|
||||
|
|
@ -248,8 +279,7 @@
|
|||
"properties": {
|
||||
"host": {
|
||||
"nullable": false,
|
||||
"type": "string",
|
||||
"default": "smtp.example.org"
|
||||
"type": "string"
|
||||
},
|
||||
"port": {
|
||||
"nullable": false,
|
||||
|
|
@ -273,7 +303,11 @@
|
|||
},
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"password"
|
||||
"host",
|
||||
"port",
|
||||
"username",
|
||||
"password",
|
||||
"sender"
|
||||
]
|
||||
}
|
||||
},
|
||||
|
|
@ -281,7 +315,9 @@
|
|||
"required": [
|
||||
"kind",
|
||||
"data"
|
||||
]
|
||||
],
|
||||
"default": {
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
@ -338,7 +374,7 @@
|
|||
},
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"acces_token",
|
||||
"access_token",
|
||||
"refresh_token"
|
||||
]
|
||||
},
|
||||
|
|
@ -384,15 +420,30 @@
|
|||
},
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"hmac_secret"
|
||||
]
|
||||
"hmac_secret",
|
||||
"lifespan",
|
||||
"cors_endpoints"
|
||||
],
|
||||
"default": {
|
||||
}
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"listen_address",
|
||||
"domain",
|
||||
"session_domain",
|
||||
"redirect_url",
|
||||
"jwt_secret",
|
||||
"session_secret",
|
||||
"storage_encryption_key",
|
||||
"users_file_path",
|
||||
"log_file_path",
|
||||
"storage",
|
||||
"ntp_server",
|
||||
"notification",
|
||||
"oidc"
|
||||
]
|
||||
],
|
||||
"default": {
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,9 +3,6 @@
|
|||
"listen_address": "0.0.0.0",
|
||||
"users_file_path": "/var/authelia/users.yml",
|
||||
"log_file_path": "/var/authelia/log.jsonl",
|
||||
"domain": "authelia.example.org",
|
||||
"redirect_url": "https://example.org",
|
||||
"session_domain": "example.org",
|
||||
"storage": {
|
||||
"kind": "sqlite",
|
||||
"data": {
|
||||
|
|
|
|||
24
roles/hedgedoc-and-nginx/cfg.schema.json
Normal file
24
roles/hedgedoc-and-nginx/cfg.schema.json
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
"nullable": false,
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"domain": {
|
||||
"nullable": false,
|
||||
"type": "string"
|
||||
},
|
||||
"tls_mode": {
|
||||
"nullable": false,
|
||||
"type": "string",
|
||||
"options": [
|
||||
"disable",
|
||||
"enable",
|
||||
"force"
|
||||
],
|
||||
"default": "force"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"domain"
|
||||
]
|
||||
}
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"var_hedgedoc_and_nginx_domain": "hedgedoc.example.org",
|
||||
"var_hedgedoc_and_nginx_tls_mode": "force"
|
||||
"cfg_hedgedoc_and_nginx_defaults": {
|
||||
"tls_mode": "force"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,11 @@
|
|||
[
|
||||
{
|
||||
"name": "show vars",
|
||||
"when": "switch_show_vars",
|
||||
"ansible.builtin.debug": {
|
||||
"var": "vars.cfg_hedgedoc_and_nginx"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "deactivate default site",
|
||||
"become": true,
|
||||
|
|
@ -12,7 +19,7 @@
|
|||
"become": true,
|
||||
"ansible.builtin.template": {
|
||||
"src": "conf.j2",
|
||||
"dest": "/etc/nginx/sites-available/{{var_hedgedoc_and_nginx_domain}}"
|
||||
"dest": "/etc/nginx/sites-available/{{cfg_hedgedoc_and_nginx.domain}}"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
@ -20,8 +27,8 @@
|
|||
"become": true,
|
||||
"ansible.builtin.file": {
|
||||
"state": "link",
|
||||
"src": "/etc/nginx/sites-available/{{var_hedgedoc_and_nginx_domain}}",
|
||||
"dest": "/etc/nginx/sites-enabled/{{var_hedgedoc_and_nginx_domain}}"
|
||||
"src": "/etc/nginx/sites-available/{{cfg_hedgedoc_and_nginx.domain}}",
|
||||
"dest": "/etc/nginx/sites-enabled/{{cfg_hedgedoc_and_nginx.domain}}"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -24,27 +24,27 @@ map $http_upgrade $connection_upgrade {
|
|||
{% endmacro %}
|
||||
|
||||
server {
|
||||
server_name {{var_hedgedoc_and_nginx_domain}};
|
||||
server_name {{cfg_hedgedoc_and_nginx.domain}};
|
||||
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
|
||||
{% if (var_element_and_nginx_tls_mode == 'force') %}
|
||||
{% if (cfg_hedgedoc_and_nginx.tls_mode == 'force') %}
|
||||
return 301 https://$http_host$request_uri;
|
||||
{% else %}
|
||||
{{ hedgedoc_common() }}
|
||||
{% endif %}
|
||||
}
|
||||
|
||||
{% if (var_hedgedoc_and_nginx_tls_mode != 'disable') %}
|
||||
{% if (cfg_hedgedoc_and_nginx.tls_mode != 'disable') %}
|
||||
server {
|
||||
server_name {{var_hedgedoc_and_nginx_domain}};
|
||||
server_name {{cfg_hedgedoc_and_nginx.domain}};
|
||||
|
||||
listen [::]:443 ssl http2;
|
||||
listen 443 ssl http2;
|
||||
|
||||
ssl_certificate_key /etc/ssl/private/{{var_hedgedoc_and_nginx_domain}}.pem;
|
||||
ssl_certificate /etc/ssl/fullchains/{{var_hedgedoc_and_nginx_domain}}.pem;
|
||||
ssl_certificate_key /etc/ssl/private/{{cfg_hedgedoc_and_nginx.domain}}.pem;
|
||||
ssl_certificate /etc/ssl/fullchains/{{cfg_hedgedoc_and_nginx.domain}}.pem;
|
||||
include /etc/nginx/ssl-hardening.conf;
|
||||
|
||||
{{ hedgedoc_common() }}
|
||||
|
|
|
|||
|
|
@ -1,15 +0,0 @@
|
|||
{
|
||||
"domain": {
|
||||
"type": "string",
|
||||
"mandatory": false
|
||||
},
|
||||
"tls_mode": {
|
||||
"type": "string",
|
||||
"options": [
|
||||
"disable",
|
||||
"enable",
|
||||
"force"
|
||||
],
|
||||
"mandatory": false
|
||||
}
|
||||
}
|
||||
248
roles/hedgedoc/cfg.schema.json
Normal file
248
roles/hedgedoc/cfg.schema.json
Normal file
|
|
@ -0,0 +1,248 @@
|
|||
{
|
||||
"nullable": false,
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"user_name": {
|
||||
"nullable": false,
|
||||
"type": "string",
|
||||
"default": "hedgedoc"
|
||||
},
|
||||
"directory": {
|
||||
"nullable": false,
|
||||
"type": "string",
|
||||
"default": "/opt/hedgedoc"
|
||||
},
|
||||
"version": {
|
||||
"nullable": false,
|
||||
"type": "string",
|
||||
"default": "1.10.3"
|
||||
},
|
||||
"domain": {
|
||||
"nullable": false,
|
||||
"type": "string"
|
||||
},
|
||||
"session_secret": {
|
||||
"nullable": false,
|
||||
"type": "string"
|
||||
},
|
||||
"database": {
|
||||
"anyOf": [
|
||||
{
|
||||
"nullable": false,
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"kind": {
|
||||
"nullable": false,
|
||||
"type": "string",
|
||||
"enum": ["sqlite"],
|
||||
"default": "sqlite"
|
||||
},
|
||||
"data": {
|
||||
"nullable": false,
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"path": {
|
||||
"nullable": false,
|
||||
"type": "string",
|
||||
"default": "/var/hedgedoc/data.sqlite"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"path"
|
||||
],
|
||||
"default": {
|
||||
}
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"kind",
|
||||
"data"
|
||||
]
|
||||
},
|
||||
{
|
||||
"nullable": false,
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"kind": {
|
||||
"nullable": false,
|
||||
"type": "string",
|
||||
"enum": ["postgresql"],
|
||||
"default": "postgresql"
|
||||
},
|
||||
"data": {
|
||||
"nullable": false,
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"host": {
|
||||
"nullable": false,
|
||||
"type": "string",
|
||||
"default": "localhost"
|
||||
},
|
||||
"port": {
|
||||
"nullable": false,
|
||||
"type": "integer",
|
||||
"default": 5432
|
||||
},
|
||||
"username": {
|
||||
"nullable": false,
|
||||
"type": "string",
|
||||
"default": "hedgedoc_user"
|
||||
},
|
||||
"password": {
|
||||
"nullable": false,
|
||||
"type": "string"
|
||||
},
|
||||
"schema": {
|
||||
"nullable": false,
|
||||
"type": "string",
|
||||
"default": "hedgedoc"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"host",
|
||||
"port",
|
||||
"username",
|
||||
"password",
|
||||
"schema"
|
||||
]
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"kind",
|
||||
"data"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"authentication": {
|
||||
"anyOf": [
|
||||
{
|
||||
"nullable": false,
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"kind": {
|
||||
"nullable": false,
|
||||
"type": "string",
|
||||
"enum": ["internal"],
|
||||
"default": "internal"
|
||||
},
|
||||
"data": {
|
||||
"nullable": false,
|
||||
"type": "object",
|
||||
"properties": {
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
],
|
||||
"default": {
|
||||
}
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"kind",
|
||||
"data"
|
||||
]
|
||||
},
|
||||
{
|
||||
"nullable": false,
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"kind": {
|
||||
"nullable": false,
|
||||
"type": "string",
|
||||
"enum": ["authelia"],
|
||||
"default": "authelia"
|
||||
},
|
||||
"data": {
|
||||
"nullable": false,
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"url_base": {
|
||||
"nullable": false,
|
||||
"type": "string"
|
||||
},
|
||||
"client_id": {
|
||||
"nullable": false,
|
||||
"type": "string",
|
||||
"default": "hedgedoc"
|
||||
},
|
||||
"client_secret": {
|
||||
"nullable": false,
|
||||
"type": "string"
|
||||
},
|
||||
"provider_name": {
|
||||
"nullable": false,
|
||||
"type": "string",
|
||||
"default": "Authelia"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"url_base",
|
||||
"client_id",
|
||||
"client_secret",
|
||||
"provider_name"
|
||||
]
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"kind",
|
||||
"data"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"guest_allow_create": {
|
||||
"nullable": false,
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"guest_allow_change": {
|
||||
"nullable": false,
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"free_names_mode": {
|
||||
"nullable": false,
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"never",
|
||||
"authed",
|
||||
"always"
|
||||
],
|
||||
"default": "authed"
|
||||
},
|
||||
"log_level": {
|
||||
"nullable": false,
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"debug",
|
||||
"verbose",
|
||||
"info",
|
||||
"warn",
|
||||
"error"
|
||||
],
|
||||
"default": "error"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"user_name",
|
||||
"directory",
|
||||
"version",
|
||||
"domain",
|
||||
"session_secret",
|
||||
"database",
|
||||
"authentication",
|
||||
"guest_allow_create",
|
||||
"guest_allow_change",
|
||||
"free_names_mode",
|
||||
"log_level"
|
||||
]
|
||||
}
|
||||
|
|
@ -1,21 +1,22 @@
|
|||
{
|
||||
"var_hedgedoc_user_name": "hedgedoc",
|
||||
"var_hedgedoc_directory": "/opt/hedgedoc",
|
||||
"var_hedgedoc_version": "1.9.9",
|
||||
"var_hedgedoc_session_secret": "REPLACE_ME",
|
||||
"var_hedgedoc_database_kind": "sqlite",
|
||||
"var_hedgedoc_database_data_sqlite_path": "/var/hedgedoc/data.sqlite",
|
||||
"var_hedgedoc_database_data_postgresql_host": "localhost",
|
||||
"var_hedgedoc_database_data_postgresql_port": 5432,
|
||||
"var_hedgedoc_database_data_postgresql_username": "hedgedoc_user",
|
||||
"var_hedgedoc_database_data_postgresql_password": "REPLACE_ME",
|
||||
"var_hedgedoc_database_data_postgresql_schema": "hedgedoc",
|
||||
"var_hedgedoc_domain": "hedgedoc.example.org",
|
||||
"var_hedgedoc_authentication_kind": "internal",
|
||||
"var_hedgedoc_authentication_data_authelia_client_id": "hedgedoc",
|
||||
"var_hedgedoc_authentication_data_authelia_client_secret": "REPLACE_ME",
|
||||
"var_hedgedoc_authentication_data_authelia_url_base": "https://authelia.example.org",
|
||||
"var_hedgedoc_guest_allow_create": false,
|
||||
"var_hedgedoc_guest_allow_change": false,
|
||||
"var_hedgedoc_free_names_mode": "authed"
|
||||
"cfg_hedgedoc_defaults": {
|
||||
"user_name": "hedgedoc",
|
||||
"directory": "/opt/hedgedoc",
|
||||
"version": "1.10.3",
|
||||
"database": {
|
||||
"kind": "sqlite",
|
||||
"data": {
|
||||
"path": "/var/hedgedoc/data.sqlite"
|
||||
}
|
||||
},
|
||||
"authentication": {
|
||||
"kind": "internal",
|
||||
"data": {
|
||||
}
|
||||
},
|
||||
"guest_allow_create": false,
|
||||
"guest_allow_change": false,
|
||||
"free_names_mode": "authed",
|
||||
"log_level": "error"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,11 @@
|
|||
[
|
||||
{
|
||||
"name": "show vars",
|
||||
"when": "switch_show_vars",
|
||||
"ansible.builtin.debug": {
|
||||
"var": "vars.cfg_hedgedoc"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "packages",
|
||||
"become": true,
|
||||
|
|
@ -26,16 +33,41 @@
|
|||
"name": "user",
|
||||
"become": true,
|
||||
"ansible.builtin.user": {
|
||||
"name": "{{var_hedgedoc_user_name}}",
|
||||
"name": "{{cfg_hedgedoc.user_name}}",
|
||||
"create_home": true,
|
||||
"home": "{{var_hedgedoc_directory}}"
|
||||
"home": "{{cfg_hedgedoc.directory}}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "database",
|
||||
"when": "cfg_hedgedoc.database.kind == 'sqlite'",
|
||||
"block": [
|
||||
{
|
||||
"name": "database | directory",
|
||||
"become": true,
|
||||
"ansible.builtin.file": {
|
||||
"state": "directory",
|
||||
"path": "{{cfg_hedgedoc.database.data.sqlite.path | dirname}}",
|
||||
"owner": "{{cfg_hedgedoc.user_name}}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "database | file",
|
||||
"become": true,
|
||||
"ansible.builtin.file": {
|
||||
"state": "touch",
|
||||
"path": "{{cfg_hedgedoc.database.data.sqlite.path}}",
|
||||
"owner": "{{cfg_hedgedoc.user_name}}"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
},
|
||||
{
|
||||
"name": "download",
|
||||
"become": false,
|
||||
"ansible.builtin.get_url": {
|
||||
"url": "https://github.com/hedgedoc/hedgedoc/releases/download/{{var_hedgedoc_version}}/hedgedoc-{{var_hedgedoc_version}}.tar.gz",
|
||||
"url": "https://github.com/hedgedoc/hedgedoc/releases/download/{{cfg_hedgedoc.version}}/hedgedoc-{{cfg_hedgedoc.version}}.tar.gz",
|
||||
"dest": "/tmp/hedgedoc.tar.gz"
|
||||
}
|
||||
},
|
||||
|
|
@ -45,8 +77,8 @@
|
|||
"ansible.builtin.unarchive": {
|
||||
"remote_src": true,
|
||||
"src": "/tmp/hedgedoc.tar.gz",
|
||||
"dest": "{{var_hedgedoc_directory | dirname}}",
|
||||
"owner": "{{var_hedgedoc_user_name}}"
|
||||
"dest": "{{cfg_hedgedoc.directory | dirname}}",
|
||||
"owner": "{{cfg_hedgedoc.user_name}}"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
@ -54,7 +86,7 @@
|
|||
"become": true,
|
||||
"become_user": "hedgedoc",
|
||||
"ansible.builtin.command": {
|
||||
"chdir": "{{var_hedgedoc_directory}}",
|
||||
"chdir": "{{cfg_hedgedoc.directory}}",
|
||||
"cmd": "bin/setup"
|
||||
}
|
||||
},
|
||||
|
|
@ -63,7 +95,7 @@
|
|||
"become": true,
|
||||
"ansible.builtin.template": {
|
||||
"src": "config.json.j2",
|
||||
"dest": "{{var_hedgedoc_directory}}/config.json"
|
||||
"dest": "{{cfg_hedgedoc.directory}}/config.json"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,61 +1,61 @@
|
|||
{
|
||||
"production": {
|
||||
"loglevel": "error",
|
||||
{% if var_hedgedoc_database_kind == 'sqlite' %}
|
||||
"loglevel": "{{cfg_hedgedoc.log_level}}",
|
||||
{% if cfg_hedgedoc.database.kind == 'sqlite' %}
|
||||
"db": {
|
||||
"dialect": "sqlite",
|
||||
"storage": "{{var_hedgedoc_database_data_sqlite_path}}"
|
||||
"storage": "{{cfg_hedgedoc.database.data.sqlite.path}}"
|
||||
},
|
||||
{% endif %}
|
||||
{% if var_hedgedoc_database_kind == 'postgresql' %}
|
||||
{% if cfg_hedgedoc.database.kind == 'postgresql' %}
|
||||
"db": {
|
||||
"dialect": "postgres",
|
||||
"host": "{{var_hedgedoc_database_data_postgresql_host}}",
|
||||
"port": {{var_hedgedoc_database_data_postgresql_port | to_json}},
|
||||
"username": "{{var_hedgedoc_database_data_postgresql_username}}",
|
||||
"password": "{{var_hedgedoc_database_data_postgresql_password}}",
|
||||
"database": "{{var_hedgedoc_database_data_postgresql_schema}}"
|
||||
"host": "{{cfg_hedgedoc.database.data.postgresql.host}}",
|
||||
"port": {{cfg_hedgedoc.database.data.postgresql.port | to_json}},
|
||||
"username": "{{cfg_hedgedoc.database.data.postgresql.username}}",
|
||||
"password": "{{cfg_hedgedoc.database.data.postgresql.password}}",
|
||||
"database": "{{cfg_hedgedoc.database.data.postgresql.schema}}"
|
||||
},
|
||||
{% endif %}
|
||||
"sessionSecret": "{{var_hedgedoc_session_secret}}",
|
||||
"sessionSecret": "{{cfg_hedgedoc.session_secret}}",
|
||||
"host": "localhost",
|
||||
"allowOrigin": [
|
||||
"localhost"
|
||||
],
|
||||
"domain": "{{var_hedgedoc_domain}}",
|
||||
"domain": "{{cfg_hedgedoc.domain}}",
|
||||
"urlAddPort": false,
|
||||
"protocolUseSSL": true,
|
||||
{% if var_hedgedoc_authentication_kind == 'internal' %}
|
||||
{% if cfg_hedgedoc.authentication.kind == 'internal' %}
|
||||
"email": true,
|
||||
"allowEmailRegister": true,
|
||||
{% endif %}
|
||||
{% if var_hedgedoc_authentication_kind == 'authelia' %}
|
||||
{% if cfg_hedgedoc.authentication.kind == 'authelia' %}
|
||||
"oauth2": {
|
||||
"providerName": "{{var_hedgedoc_authentication_data_authelia_provider_name}}",
|
||||
"clientID": "{{var_hedgedoc_authentication_data_authelia_client_id}}",
|
||||
"clientSecret": "{{var_hedgedoc_authentication_data_authelia_client_secret}}",
|
||||
"providerName": "{{cfg_hedgedoc.authentication.data.authelia.provider_name}}",
|
||||
"clientID": "{{cfg_hedgedoc.authentication.data.authelia.client_id}}",
|
||||
"clientSecret": "{{cfg_hedgedoc.authentication.data.authelia.client_secret}}",
|
||||
"scope": "openid email profile",
|
||||
"userProfileUsernameAttr": "sub",
|
||||
"userProfileDisplayNameAttr": "name",
|
||||
"userProfileEmailAttr": "email",
|
||||
"userProfileURL": "{{var_hedgedoc_authentication_data_authelia_url_base}}/api/oidc/userinfo",
|
||||
"tokenURL": "{{var_hedgedoc_authentication_data_authelia_url_base}}/api/oidc/token",
|
||||
"authorizationURL": "{{var_hedgedoc_authentication_data_authelia_url_base}}/api/oidc/authorization"
|
||||
"userProfileURL": "{{cfg_hedgedoc.authentication.data.authelia.url_base}}/api/oidc/userinfo",
|
||||
"tokenURL": "{{cfg_hedgedoc.authentication.data.authelia.url_base}}/api/oidc/token",
|
||||
"authorizationURL": "{{cfg_hedgedoc.authentication.data.authelia.url_base}}/api/oidc/authorization"
|
||||
},
|
||||
"email": false,
|
||||
"allowEmailRegister": false,
|
||||
{% endif %}
|
||||
"allowAnonymous": {{var_hedgedoc_guest_allow_create | to_json}},
|
||||
"allowAnonymousEdits": {{var_hedgedoc_guest_allow_change | to_json}},
|
||||
{% if var_hedgedoc_free_names_mode == 'never' %}
|
||||
"allowAnonymous": {{cfg_hedgedoc.guest_allow_create | to_json}},
|
||||
"allowAnonymousEdits": {{cfg_hedgedoc.guest_allow_change | to_json}},
|
||||
{% if cfg_hedgedoc.free_names_mode == 'never' %}
|
||||
"allowFreeURL": false,
|
||||
"requireFreeURLAuthentication": false,
|
||||
{% endif %}
|
||||
{% if var_hedgedoc_free_names_mode == 'authed' %}
|
||||
{% if cfg_hedgedoc.free_names_mode == 'authed' %}
|
||||
"allowFreeURL": true,
|
||||
"requireFreeURLAuthentication": true,
|
||||
{% endif %}
|
||||
{% if var_hedgedoc_free_names_mode == 'always' %}
|
||||
{% if cfg_hedgedoc.free_names_mode == 'always' %}
|
||||
"allowFreeURL": true,
|
||||
"requireFreeURLAuthentication": false,
|
||||
{% endif %}
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ Description=Hedgedoc
|
|||
After=multi-user.target
|
||||
|
||||
[Service]
|
||||
WorkingDirectory={{var_hedgedoc_directory}}
|
||||
User={{var_hedgedoc_user_name}}
|
||||
WorkingDirectory={{cfg_hedgedoc.directory}}
|
||||
User={{cfg_hedgedoc.user_name}}
|
||||
Environment="NODE_ENV=production"
|
||||
ExecStart=yarn start
|
||||
SyslogIdentifier=hedgedoc
|
||||
|
|
|
|||
|
|
@ -1,87 +0,0 @@
|
|||
{
|
||||
"user_name": {
|
||||
"type": "string",
|
||||
"mandatory": false
|
||||
},
|
||||
"directory": {
|
||||
"type": "string",
|
||||
"mandatory": false
|
||||
},
|
||||
"version": {
|
||||
"type": "string",
|
||||
"mandatory": false
|
||||
},
|
||||
"session_secret": {
|
||||
"type": "string",
|
||||
"mandatory": true
|
||||
},
|
||||
"database_kind": {
|
||||
"type": "string",
|
||||
"mandatory": false,
|
||||
"options": [
|
||||
"sqlite",
|
||||
"postgresql",
|
||||
"mariadb"
|
||||
]
|
||||
},
|
||||
"database_data_sqlite_path": {
|
||||
"type": "string",
|
||||
"mandatory": false
|
||||
},
|
||||
"database_data_postgresql_host": {
|
||||
"type": "string",
|
||||
"mandatory": false
|
||||
},
|
||||
"database_data_postgresql_port": {
|
||||
"type": "integer",
|
||||
"mandatory": false
|
||||
},
|
||||
"database_data_postgresql_username": {
|
||||
"type": "string",
|
||||
"mandatory": false
|
||||
},
|
||||
"database_data_postgresql_password": {
|
||||
"type": "string",
|
||||
"mandatory": false
|
||||
},
|
||||
"database_data_postgresql_schema": {
|
||||
"type": "string",
|
||||
"mandatory": false
|
||||
},
|
||||
"domain": {
|
||||
"type": "string",
|
||||
"mandatory": false
|
||||
},
|
||||
"authentication_kind": {
|
||||
"type": "string",
|
||||
"mandatory": false,
|
||||
"options": [
|
||||
"internal",
|
||||
"authelia"
|
||||
]
|
||||
},
|
||||
"authentication_data_authelia_client_id": {
|
||||
"type": "string",
|
||||
"mandatory": false
|
||||
},
|
||||
"authentication_data_authelia_client_secret": {
|
||||
"type": "string",
|
||||
"mandatory": false
|
||||
},
|
||||
"authentication_data_authelia_url_base": {
|
||||
"type": "string",
|
||||
"mandatory": false
|
||||
},
|
||||
"guest_allow_create": {
|
||||
"type": "boolean",
|
||||
"mandatory": false
|
||||
},
|
||||
"guest_allow_change": {
|
||||
"type": "boolean",
|
||||
"mandatory": false
|
||||
},
|
||||
"free_names_mode": {
|
||||
"type": "string",
|
||||
"mandatory": false
|
||||
}
|
||||
}
|
||||
|
|
@ -9,7 +9,7 @@
|
|||
"default": null
|
||||
},
|
||||
"dhparam_size": {
|
||||
"nullable": false,
|
||||
"nullable": true,
|
||||
"type": "integer",
|
||||
"default": null
|
||||
},
|
||||
|
|
@ -21,5 +21,8 @@
|
|||
},
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"auto_reload_interval",
|
||||
"dhparam_size",
|
||||
"improved_security"
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"cfg_nginx_defaults": {
|
||||
"auto_reload_interval": null,
|
||||
"dhparam_size": 2048
|
||||
"dhparam_size": null,
|
||||
"improved_security": false
|
||||
}
|
||||
}
|
||||
|
|
|
|||
31
roles/owncloud-and-nginx/cfg.schema.json
Normal file
31
roles/owncloud-and-nginx/cfg.schema.json
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
{
|
||||
"nullable": false,
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"domain": {
|
||||
"nullable": false,
|
||||
"type": "string"
|
||||
},
|
||||
"tls_mode": {
|
||||
"nullable": false,
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"disable",
|
||||
"enable",
|
||||
"force"
|
||||
],
|
||||
"default": "force"
|
||||
},
|
||||
"maximum_upload_size": {
|
||||
"nullable": false,
|
||||
"type": "string",
|
||||
"default": "1G"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"domain",
|
||||
"tls_mode",
|
||||
"maximum_upload_size"
|
||||
]
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"var_owncloud_and_nginx_domain": "owncloud.example.org",
|
||||
"var_owncloud_and_nginx_tls_mode": "force",
|
||||
"var_owncloud_and_nginx_maximum_upload_size": "1G"
|
||||
"cfg_owncloud_and_nginx_defaults": {
|
||||
"tls_mode": "force",
|
||||
"maximum_upload_size": "1G"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,11 @@
|
|||
[
|
||||
{
|
||||
"name": "show vars",
|
||||
"when": "switch_show_vars",
|
||||
"ansible.builtin.debug": {
|
||||
"var": "vars.cfg_owncloud_and_nginx"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "deactivate default site",
|
||||
"become": true,
|
||||
|
|
@ -12,7 +19,7 @@
|
|||
"become": true,
|
||||
"ansible.builtin.template": {
|
||||
"src": "conf.j2",
|
||||
"dest": "/etc/nginx/sites-available/{{var_owncloud_and_nginx_domain}}"
|
||||
"dest": "/etc/nginx/sites-available/{{cfg_owncloud_and_nginx.domain}}"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
@ -20,8 +27,8 @@
|
|||
"become": true,
|
||||
"ansible.builtin.file": {
|
||||
"state": "link",
|
||||
"src": "/etc/nginx/sites-available/{{var_owncloud_and_nginx_domain}}",
|
||||
"dest": "/etc/nginx/sites-enabled/{{var_owncloud_and_nginx_domain}}"
|
||||
"src": "/etc/nginx/sites-available/{{cfg_owncloud_and_nginx.domain}}",
|
||||
"dest": "/etc/nginx/sites-enabled/{{cfg_owncloud_and_nginx.domain}}"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{% macro owncloud_common() %}
|
||||
location / {
|
||||
proxy_pass http://localhost:9200;
|
||||
client_max_body_size {{var_owncloud_and_nginx_maximum_upload_size}};
|
||||
client_max_body_size {{cfg_owncloud_and_nginx.maximum_upload_size}};
|
||||
}
|
||||
{% endmacro %}
|
||||
|
||||
|
|
@ -9,24 +9,24 @@ server {
|
|||
listen 80;
|
||||
listen [::]:80;
|
||||
|
||||
server_name {{var_owncloud_and_nginx_domain}};
|
||||
server_name {{cfg_owncloud_and_nginx.domain}};
|
||||
|
||||
{% if var_owncloud_and_nginx_tls_mode == 'force' %}
|
||||
{% if cfg_owncloud_and_nginx.tls_mode == 'force' %}
|
||||
return 301 https://$http_host$request_uri;
|
||||
{% else %}
|
||||
{{ owncloud_common() }}
|
||||
{% endif %}
|
||||
}
|
||||
|
||||
{% if var_owncloud_and_nginx_tls_mode != 'disable' %}
|
||||
{% if cfg_owncloud_and_nginx.tls_mode != 'disable' %}
|
||||
server {
|
||||
listen 443 ssl;
|
||||
listen [::]:443 ssl;
|
||||
|
||||
server_name {{var_owncloud_and_nginx_domain}};
|
||||
server_name {{cfg_owncloud_and_nginx.domain}};
|
||||
|
||||
ssl_certificate_key /etc/ssl/private/{{var_owncloud_and_nginx_domain}}.pem;
|
||||
ssl_certificate /etc/ssl/fullchains/{{var_owncloud_and_nginx_domain}}.pem;
|
||||
ssl_certificate_key /etc/ssl/private/{{cfg_owncloud_and_nginx.domain}}.pem;
|
||||
ssl_certificate /etc/ssl/fullchains/{{cfg_owncloud_and_nginx.domain}}.pem;
|
||||
include /etc/nginx/ssl-hardening.conf;
|
||||
|
||||
{{ owncloud_common() }}
|
||||
|
|
|
|||
|
|
@ -1,20 +0,0 @@
|
|||
|
||||
{
|
||||
"domain": {
|
||||
"type": "string",
|
||||
"mandatory": false
|
||||
},
|
||||
"tls_mode": {
|
||||
"type": "string",
|
||||
"options": [
|
||||
"disable",
|
||||
"enable",
|
||||
"force"
|
||||
],
|
||||
"mandatory": false
|
||||
},
|
||||
"maximum_upload_size": {
|
||||
"type": "string",
|
||||
"mandatory": false
|
||||
}
|
||||
}
|
||||
|
|
@ -24,8 +24,7 @@
|
|||
},
|
||||
"domain": {
|
||||
"nullable": false,
|
||||
"type": "string",
|
||||
"default": "owncloud.example.org"
|
||||
"type": "string"
|
||||
},
|
||||
"admin_password": {
|
||||
"nullable": false,
|
||||
|
|
@ -39,7 +38,8 @@
|
|||
"properties": {
|
||||
"kind": {
|
||||
"type": "string",
|
||||
"enum": ["internal"]
|
||||
"enum": ["internal"],
|
||||
"default": "internal"
|
||||
},
|
||||
"data": {
|
||||
"nullable": false,
|
||||
|
|
@ -55,7 +55,8 @@
|
|||
},
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"kind"
|
||||
"kind",
|
||||
"data"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -64,7 +65,8 @@
|
|||
"properties": {
|
||||
"kind": {
|
||||
"type": "string",
|
||||
"enum": ["authelia"]
|
||||
"enum": ["authelia"],
|
||||
"default": "authelia"
|
||||
},
|
||||
"data": {
|
||||
"nullable": false,
|
||||
|
|
@ -86,6 +88,7 @@
|
|||
},
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"client_id"
|
||||
],
|
||||
"default": {
|
||||
}
|
||||
|
|
@ -93,7 +96,8 @@
|
|||
},
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"url_base"
|
||||
"url_base",
|
||||
"web"
|
||||
]
|
||||
}
|
||||
},
|
||||
|
|
@ -127,6 +131,8 @@
|
|||
},
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"password_necessity",
|
||||
"password_policy_active"
|
||||
],
|
||||
"default": {
|
||||
}
|
||||
|
|
@ -134,6 +140,13 @@
|
|||
},
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"admin_password"
|
||||
"user",
|
||||
"directory",
|
||||
"version",
|
||||
"platform",
|
||||
"domain",
|
||||
"admin_password",
|
||||
"authentication",
|
||||
"public_share"
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,18 +1,16 @@
|
|||
{
|
||||
"var_owncloud_user": "owncloud",
|
||||
"var_owncloud_directory": "/opt/owncloud",
|
||||
"var_owncloud_version": "5.0.0",
|
||||
"var_owncloud_platform": "linux-amd64",
|
||||
"var_owncloud_domain": "owncloud.example.org",
|
||||
"var_owncloud_admin_password": "REPLACE_ME",
|
||||
"var_owncloud_authentication_kind": "internal",
|
||||
"var_owncloud_authentication_data_authelia_url_base": "https://authelia.example.org",
|
||||
"var_owncloud_authentication_data_authelia_web_client_id": "owncloud_web",
|
||||
"var_owncloud_authentication_data_authelia_web_client_secret": "REPLACE_ME",
|
||||
"var_owncloud_authentication_data_authelia_android_client_id": "owncloud_android",
|
||||
"var_owncloud_authentication_data_authelia_android_client_secret": "REPLACE_ME",
|
||||
"var_owncloud_authentication_data_authelia_ios_client_id": "owncloud_ios",
|
||||
"var_owncloud_authentication_data_authelia_ios_client_secret": "REPLACE_ME",
|
||||
"var_owncloud_public_share_password_necessity": "writable",
|
||||
"var_owncloud_public_share_password_policy_active": true
|
||||
"cfg_owncloud_defaults": {
|
||||
"user": "owncloud",
|
||||
"directory": "/opt/owncloud",
|
||||
"version": "7.2.0",
|
||||
"platform": "linux-amd64",
|
||||
"domain": "owncloud.example.org",
|
||||
"authentication": {
|
||||
"kind": "internal"
|
||||
},
|
||||
"public_share": {
|
||||
"password_necessity": "writable",
|
||||
"password_policy_active": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,13 +7,26 @@ Cloud-Plattform [ownCloud](https://owncloud.com/) (the rewrite in Go named "Infi
|
|||
|
||||
- [ownCloud-Dokumentation | How to install ownCloud Infinite Scale Tech Preview in three easy steps](https://owncloud.com/news/howto-install-owncloud-infinite-scale-tech-preview/)
|
||||
- [ownCloud-Dokumentation | oCIS](https://owncloud.dev/ocis/)
|
||||
- [ownCloud-Dokumentation | Service | Proxy](https://doc.owncloud.com/ocis/next/deployment/services/s-list/proxy.html)
|
||||
- [ownCloud-Dokumentation | Upgrading](https://doc.owncloud.com/ocis/next/migration/upgrading-ocis.html)
|
||||
- [ownCloud-Dokumentation | env var types](https://doc.owncloud.com/ocis/next/deployment/services/envvar-types-description.html)
|
||||
- [ownCloud-Dokumentation | Service | Web](https://doc.owncloud.com/ocis/next/deployment/services/s-list/web.html)
|
||||
- [ownCloud-Dokumentation | Service | Proxy](https://doc.owncloud.com/ocis/next/deployment/services/s-list/proxy.html)
|
||||
- [ownCloud-Dokumentation | Service | Sharing](https://doc.owncloud.com/ocis/next/deployment/services/s-list/sharing.html)
|
||||
- [GitHub | ocis](https://github.com/owncloud/ocis/)
|
||||
- [ownCloud-Foren | OCIS + Authelia](https://central.owncloud.org/t/ocis-authelia/44222)
|
||||
|
||||
|
||||
## Bemerkungen
|
||||
|
||||
- die `.ocis/config/ocis.yaml` wird erzeugt auf Grundlage der `.env`
|
||||
- `.ocis/config/ocis.yaml` sollte niemals einfach neu erstellt werden, da man sich sonst nicht mehr einloggen kann
|
||||
- wenn man sich plötzlich nicht mehr über OIDC anmelden kann, kann das daran lieget, dass `.ocis/idm/ldap.crt` abgelaufen ist — siehe dazu [diesen Thread](https://central.owncloud.org/t/certificate-error-after-upgrade-to-5-0-0-from-4-0-6/47824/7); man könnte auch `OCIS_LDAP_INSECURE` auf `true` setzen, aber naja…
|
||||
|
||||
|
||||
## ToDo
|
||||
|
||||
- Download prüfen
|
||||
- `csp.yaml` einsetzen
|
||||
- prüfen ob folgende `.env`-Variablen gebraucht werden:
|
||||
- `PROXY_OIDC_ISSUER`
|
||||
- `PROXY_OIDC_SKIP_USER_INFO`
|
||||
|
|
|
|||
|
|
@ -1,39 +1,70 @@
|
|||
[
|
||||
{
|
||||
"name": "show vars",
|
||||
"when": "switch_show_vars",
|
||||
"ansible.builtin.debug": {
|
||||
"var": "vars.cfg_owncloud"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "user",
|
||||
"become": true,
|
||||
"ansible.builtin.user": {
|
||||
"name": "{{var_owncloud_user}}",
|
||||
"name": "{{cfg_owncloud.user}}",
|
||||
"create_home": true,
|
||||
"home": "{{var_owncloud_directory}}"
|
||||
"home": "{{cfg_owncloud.directory}}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "download",
|
||||
"become": true,
|
||||
"become_user": "{{var_owncloud_user}}",
|
||||
"become_user": "{{cfg_owncloud.user}}",
|
||||
"ansible.builtin.get_url": {
|
||||
"url": "https://download.owncloud.com/ocis/ocis/stable/{{var_owncloud_version}}/ocis-{{var_owncloud_version}}-{{var_owncloud_platform}}",
|
||||
"dest": "{{var_owncloud_directory}}/ocis",
|
||||
"url": "https://download.owncloud.com/ocis/ocis/stable/{{cfg_owncloud.version}}/ocis-{{cfg_owncloud.version}}-{{cfg_owncloud.platform}}",
|
||||
"dest": "{{cfg_owncloud.directory}}/ocis",
|
||||
"mode": "u+rx"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "directories",
|
||||
"become": true,
|
||||
"become_user": "{{cfg_owncloud.user}}",
|
||||
"loop": [
|
||||
"log"
|
||||
],
|
||||
"ansible.builtin.file": {
|
||||
"state": "directory",
|
||||
"recurse": true,
|
||||
"path": "{{cfg_owncloud.directory}}/{{item}}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "csp",
|
||||
"become": true,
|
||||
"become_user": "{{cfg_owncloud.user}}",
|
||||
"ansible.builtin.template": {
|
||||
"src": "csp.yaml.j2",
|
||||
"mode": "644",
|
||||
"dest": "{{cfg_owncloud.directory}}/csp.yaml"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "env",
|
||||
"become": true,
|
||||
"become_user": "{{cfg_owncloud.user}}",
|
||||
"ansible.builtin.template": {
|
||||
"src": "env.j2",
|
||||
"mode": "644",
|
||||
"dest": "{{cfg_owncloud.directory}}/.env"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "setup",
|
||||
"become": true,
|
||||
"become_user": "{{var_owncloud_user}}",
|
||||
"become_user": "{{cfg_owncloud.user}}",
|
||||
"ansible.builtin.shell": {
|
||||
"chdir": "{{var_owncloud_directory}}",
|
||||
"cmd": "rm -f {{var_owncloud_directory}}/.ocis/config/ocis.yaml && ./ocis init --insecure no --admin-password={{var_owncloud_admin_password}}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "configuration",
|
||||
"become": true,
|
||||
"become_user": "{{var_owncloud_user}}",
|
||||
"ansible.builtin.template": {
|
||||
"src": "env.j2",
|
||||
"dest": "{{var_owncloud_directory}}/.env"
|
||||
"chdir": "{{cfg_owncloud.directory}}",
|
||||
"cmd": "./ocis init --insecure no --admin-password={{cfg_owncloud.admin_password}}"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
directives:
|
||||
connect-src:
|
||||
- '''self'''
|
||||
- 'https://{{cfg_owncloud.domain}}'
|
||||
{% if cfg_owncloud.authentication.kind == 'authelia' %}
|
||||
- '{{cfg_owncloud.authentication.data.url_base}}'
|
||||
{% endif %}
|
||||
|
|
|
|||
|
|
@ -1,44 +1,62 @@
|
|||
OCIS_URL="https://{{var_owncloud_domain}}"
|
||||
OCIS_INSECURE="false"
|
||||
|
||||
PROXY_TLS="false"
|
||||
|
||||
{% if var_owncloud_authentication_kind == 'internal' %}
|
||||
PROXY_AUTOPROVISION_ACCOUNTS="false"
|
||||
## web client
|
||||
WEB_LOG_LEVEL=info
|
||||
WEB_LOG_FILE={{cfg_owncloud.directory}}/log/web
|
||||
WEB_LOG_PRETTY=true
|
||||
WEB_LOG_COLOR=true
|
||||
{% if cfg_owncloud.authentication.kind == 'internal' %}
|
||||
{% endif %}
|
||||
{% if cfg_owncloud.authentication.kind == 'authelia' %}
|
||||
WEB_OIDC_AUTHORITY={{cfg_owncloud.authentication.data.url_base}}
|
||||
WEB_OIDC_CLIENT_ID={{cfg_owncloud.authentication.data.web.client_id}}
|
||||
WEB_OIDC_RESPONSE_TYPE=code
|
||||
WEB_OIDC_SCOPE=openid profile email groups
|
||||
WEB_OPTION_LOGIN_URL={{cfg_owncloud.authentication.data.url_base}}
|
||||
WEB_OPTION_LOGOUT_URL={{cfg_owncloud.authentication.data.url_base}}
|
||||
WEB_UI_THEME_SERVER=https://{{cfg_owncloud.domain}}
|
||||
WEB_UI_CONFIG_SERVER=https://{{cfg_owncloud.domain}}
|
||||
{% endif %}
|
||||
|
||||
{% if var_owncloud_authentication_kind == 'authelia' %}
|
||||
OCIS_OIDC_CLIENT_ID="{{var_owncloud_authentication_data_authelia_web_client_id}}"
|
||||
OCIS_OIDC_ISSUER="{{var_owncloud_authentication_data_authelia_url_base}}"
|
||||
|
||||
PROXY_AUTOPROVISION_ACCOUNTS="true"
|
||||
PROXY_OIDC_REWRITE_WELLKNOWN="true"
|
||||
PROXY_OIDC_ACCESS_TOKEN_VERIFY_METHOD="none"
|
||||
PROXY_OIDC_INSECURE="false"
|
||||
PROXY_USER_OIDC_CLAIM="name"
|
||||
PROXY_USER_CS3_CLAIM="username"
|
||||
|
||||
WEB_OIDC_AUTHORITY="{{var_owncloud_authentication_data_authelia_url_base}}"
|
||||
WEB_OIDC_METADATA_URL="{{var_owncloud_authentication_data_authelia_url_base}}/.well-known/openid-configuration"
|
||||
WEB_OIDC_CLIENT_ID="{{var_owncloud_authentication_data_authelia_web_client_id}}"
|
||||
WEB_OIDC_SCOPE="openid profile email groups"
|
||||
## other clients
|
||||
PROXY_LOG_LEVEL=info
|
||||
PROXY_LOG_FILE={{cfg_owncloud.directory}}/log/proxy
|
||||
PROXY_LOG_PRETTY=true
|
||||
PROXY_LOG_COLOR=true
|
||||
PROXY_CSP_CONFIG_FILE_LOCATION={{cfg_owncloud.directory}}/csp.yaml
|
||||
PROXY_TLS=false
|
||||
{% if cfg_owncloud.authentication.kind == 'internal' %}
|
||||
PROXY_AUTOPROVISION_ACCOUNTS=false
|
||||
{% endif %}
|
||||
{% if cfg_owncloud.authentication.kind == 'authelia' %}
|
||||
OCIS_URL=https://{{cfg_owncloud.domain}}
|
||||
PROXY_OIDC_ISSUER={{cfg_owncloud.authentication.data.url_base}}
|
||||
PROXY_OIDC_REWRITE_WELLKNOWN=true
|
||||
PROXY_OIDC_ACCESS_TOKEN_VERIFY_METHOD=none
|
||||
PROXY_OIDC_SKIP_USER_INFO=false
|
||||
PROXY_AUTOPROVISION_ACCOUNTS=true
|
||||
PROXY_AUTOPROVISION_CLAIM_USERNAME=preferred_username
|
||||
PROXY_AUTOPROVISION_CLAIM_EMAIL=email
|
||||
PROXY_AUTOPROVISION_CLAIM_DISPLAYNAME=name
|
||||
PROXY_AUTOPROVISION_CLAIM_GROUPS=groups
|
||||
PROXY_USER_OIDC_CLAIM=preferred_username
|
||||
PROXY_USER_CS3_CLAIM=username
|
||||
{% endif %}
|
||||
|
||||
{% if var_owncloud_public_share_password_necessity == 'nothing' %}
|
||||
OCIS_SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD="false"
|
||||
OCIS_SHARING_PUBLIC_WRITEABLE_SHARE_MUST_HAVE_PASSWORD="false"
|
||||
## sharing
|
||||
{% if cfg_owncloud.public_share.password_necessity == 'nothing' %}
|
||||
OCIS_SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD=false
|
||||
OCIS_SHARING_PUBLIC_WRITEABLE_SHARE_MUST_HAVE_PASSWORD=false
|
||||
{% endif %}
|
||||
{% if var_owncloud_public_share_password_necessity == 'writable' %}
|
||||
OCIS_SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD="false"
|
||||
OCIS_SHARING_PUBLIC_WRITEABLE_SHARE_MUST_HAVE_PASSWORD="true"
|
||||
{% if cfg_owncloud.public_share.password_necessity == 'writable' %}
|
||||
OCIS_SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD=false
|
||||
OCIS_SHARING_PUBLIC_WRITEABLE_SHARE_MUST_HAVE_PASSWORD=true
|
||||
{% endif %}
|
||||
{% if var_owncloud_public_share_password_necessity == 'all' %}
|
||||
OCIS_SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD="true"
|
||||
OCIS_SHARING_PUBLIC_WRITEABLE_SHARE_MUST_HAVE_PASSWORD="true"
|
||||
{% if cfg_owncloud.public_share.password_necessity == 'all' %}
|
||||
OCIS_SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD=true
|
||||
OCIS_SHARING_PUBLIC_WRITEABLE_SHARE_MUST_HAVE_PASSWORD=true
|
||||
{% endif %}
|
||||
|
||||
{% if var_owncloud_public_share_password_policy_active %}
|
||||
OCIS_SHARING_PASSWORD_POLICY_DISABLED="false"
|
||||
{% if cfg_owncloud.public_share.password_policy_active %}
|
||||
OCIS_SHARING_PASSWORD_POLICY_DISABLED=false
|
||||
{% else %}
|
||||
OCIS_SHARING_PASSWORD_POLICY_DISABLED="true"
|
||||
OCIS_SHARING_PASSWORD_POLICY_DISABLED=true
|
||||
{% endif %}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,12 +3,12 @@ Description=ownCloud
|
|||
After=network.target
|
||||
|
||||
[Service]
|
||||
WorkingDirectory={{var_owncloud_directory}}
|
||||
EnvironmentFile={{var_owncloud_directory}}/.env
|
||||
ExecStart={{var_owncloud_directory}}/ocis server
|
||||
WorkingDirectory={{cfg_owncloud.directory}}
|
||||
EnvironmentFile={{cfg_owncloud.directory}}/.env
|
||||
ExecStart={{cfg_owncloud.directory}}/ocis server
|
||||
Type=simple
|
||||
Restart=always
|
||||
User={{var_owncloud_user}}
|
||||
User={{cfg_owncloud.user}}
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
|
|
|
|||
|
|
@ -1,75 +0,0 @@
|
|||
{
|
||||
"user": {
|
||||
"type": "string",
|
||||
"mandatory": false
|
||||
},
|
||||
"directory": {
|
||||
"type": "string",
|
||||
"mandatory": false
|
||||
},
|
||||
"version": {
|
||||
"type": "string",
|
||||
"mandatory": false
|
||||
},
|
||||
"platform": {
|
||||
"type": "string",
|
||||
"mandatory": false
|
||||
},
|
||||
"domain": {
|
||||
"type": "string",
|
||||
"mandatory": false
|
||||
},
|
||||
"admin_password": {
|
||||
"type": "string",
|
||||
"mandatory": true
|
||||
},
|
||||
"authentication_kind": {
|
||||
"type": "string",
|
||||
"mandatory": false,
|
||||
"options": [
|
||||
"internal",
|
||||
"authelia"
|
||||
]
|
||||
},
|
||||
"authentication_data_authelia_url_base": {
|
||||
"type": "string",
|
||||
"mandatory": false
|
||||
},
|
||||
"authentication_data_authelia_web_client_id": {
|
||||
"type": "string",
|
||||
"mandatory": false
|
||||
},
|
||||
"authentication_data_authelia_web_client_secret": {
|
||||
"type": "string",
|
||||
"mandatory": false
|
||||
},
|
||||
"authentication_data_authelia_android_client_id": {
|
||||
"type": "string",
|
||||
"mandatory": false
|
||||
},
|
||||
"authentication_data_authelia_android_client_secret": {
|
||||
"type": "string",
|
||||
"mandatory": false
|
||||
},
|
||||
"authentication_data_authelia_ios_client_id": {
|
||||
"type": "string",
|
||||
"mandatory": false
|
||||
},
|
||||
"authentication_data_authelia_ios_client_secret": {
|
||||
"type": "string",
|
||||
"mandatory": false
|
||||
},
|
||||
"public_share_password_necessity": {
|
||||
"type": "string",
|
||||
"mandatory": false,
|
||||
"options": [
|
||||
"nothing",
|
||||
"writable",
|
||||
"all"
|
||||
]
|
||||
},
|
||||
"public_share_password_policy_active": {
|
||||
"type": "boolean",
|
||||
"mandatory": false
|
||||
}
|
||||
}
|
||||
|
|
@ -39,7 +39,7 @@
|
|||
"become_user": "postgres",
|
||||
"community.postgresql.postgresql_privs": {
|
||||
"state": "present",
|
||||
"db": "{{var_postgresql_for_authelia_schema}}",
|
||||
"login_db": "{{var_postgresql_for_authelia_schema}}",
|
||||
"objs": "ALL_IN_SCHEMA",
|
||||
"roles": "{{var_postgresql_for_authelia_username}}",
|
||||
"privs": "ALL",
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@
|
|||
"become_user": "postgres",
|
||||
"community.postgresql.postgresql_privs": {
|
||||
"state": "present",
|
||||
"db": "{{var_postgresql_for_forgejo_schema}}",
|
||||
"login_db": "{{var_postgresql_for_forgejo_schema}}",
|
||||
"objs": "ALL_IN_SCHEMA",
|
||||
"roles": "{{var_postgresql_for_forgejo_username}}",
|
||||
"privs": "ALL",
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@
|
|||
"become_user": "postgres",
|
||||
"community.postgresql.postgresql_privs": {
|
||||
"state": "present",
|
||||
"db": "{{var_postgresql_for_gitlab_schema}}",
|
||||
"login_db": "{{var_postgresql_for_gitlab_schema}}",
|
||||
"objs": "ALL_IN_SCHEMA",
|
||||
"roles": "{{var_postgresql_for_gitlab_username}}",
|
||||
"privs": "ALL",
|
||||
|
|
@ -57,7 +57,7 @@
|
|||
],
|
||||
"community.postgresql.postgresql_ext": {
|
||||
"state": "present",
|
||||
"db": "{{var_postgresql_for_gitlab_schema}}",
|
||||
"login_db": "{{var_postgresql_for_gitlab_schema}}",
|
||||
"name": "{{item}}"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@
|
|||
"become_user": "postgres",
|
||||
"community.postgresql.postgresql_privs": {
|
||||
"state": "present",
|
||||
"db": "{{var_postgresql_for_hedgedoc_schema}}",
|
||||
"login_db": "{{var_postgresql_for_hedgedoc_schema}}",
|
||||
"objs": "ALL_IN_SCHEMA",
|
||||
"roles": "{{var_postgresql_for_hedgedoc_username}}",
|
||||
"privs": "ALL",
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@
|
|||
"become_user": "postgres",
|
||||
"community.postgresql.postgresql_privs": {
|
||||
"state": "present",
|
||||
"db": "{{var_postgresql_for_synapse_schema}}",
|
||||
"login_db": "{{var_postgresql_for_synapse_schema}}",
|
||||
"objs": "ALL_IN_SCHEMA",
|
||||
"roles": "{{var_postgresql_for_synapse_username}}",
|
||||
"privs": "ALL",
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@
|
|||
"become_user": "postgres",
|
||||
"community.postgresql.postgresql_privs": {
|
||||
"state": "present",
|
||||
"db": "{{var_postgresql_for_tandoor_schema}}",
|
||||
"login_db": "{{var_postgresql_for_tandoor_schema}}",
|
||||
"objs": "ALL_IN_SCHEMA",
|
||||
"roles": "{{var_postgresql_for_tandoor_username}}",
|
||||
"privs": "ALL",
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@
|
|||
"become_user": "postgres",
|
||||
"community.postgresql.postgresql_privs": {
|
||||
"state": "present",
|
||||
"db": "{{var_postgresql_for_vikunja_schema}}",
|
||||
"login_db": "{{var_postgresql_for_vikunja_schema}}",
|
||||
"objs": "ALL_IN_SCHEMA",
|
||||
"roles": "{{var_postgresql_for_vikunja_username}}",
|
||||
"privs": "ALL",
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@
|
|||
"become_user": "postgres",
|
||||
"community.postgresql.postgresql_privs": {
|
||||
"state": "present",
|
||||
"db": "{{var_postgresql_for_wiki_js_schema}}",
|
||||
"login_db": "{{var_postgresql_for_wiki_js_schema}}",
|
||||
"objs": "ALL_IN_SCHEMA",
|
||||
"roles": "{{var_postgresql_for_wiki_js_username}}",
|
||||
"privs": "ALL",
|
||||
|
|
|
|||
|
|
@ -1,4 +0,0 @@
|
|||
{
|
||||
"var_sqlite_for_hedgedoc_path": "/var/hedgedoc/data.sqlite",
|
||||
"var_sqlite_for_hedgedoc_user_name": "hedgedoc"
|
||||
}
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
[
|
||||
{
|
||||
"name": "directory",
|
||||
"become": true,
|
||||
"ansible.builtin.file": {
|
||||
"state": "directory",
|
||||
"path": "{{var_sqlite_for_hedgedoc_path | dirname}}",
|
||||
"owner": "{{var_hedgedoc_user_name}}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "file",
|
||||
"become": true,
|
||||
"ansible.builtin.file": {
|
||||
"state": "touch",
|
||||
"path": "{{var_sqlite_for_hedgedoc_path}}",
|
||||
"owner": "{{var_sqlite_for_hedgedoc_user_name}}"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
{
|
||||
"path": {
|
||||
"type": "string",
|
||||
"mandatory": false
|
||||
},
|
||||
"user_name": {
|
||||
"type": "string",
|
||||
"mandatory": false
|
||||
}
|
||||
}
|
||||
|
|
@ -124,6 +124,7 @@ oidc_providers:
|
|||
localpart_template: "{{"{{"}} user.preferred_username {{"}}"}}"
|
||||
display_name_template: "{{"{{"}} user.name {{"}}"}}"
|
||||
email_template: "{{"{{"}} user.email {{"}}"}}"
|
||||
user_profile_method: "userinfo_endpoint"
|
||||
{% endif %}
|
||||
|
||||
account_validity:
|
||||
|
|
|
|||
14
roles/tlscert_selfsigned/cfg.schema.json
Normal file
14
roles/tlscert_selfsigned/cfg.schema.json
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"nullable": false,
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"domain": {
|
||||
"nullable": false,
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"domain"
|
||||
]
|
||||
}
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
{
|
||||
"var_tlscert_selfsigned_domain": "foo.example.org"
|
||||
"cfg_tlscert_selfsigned_defaults": {
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,11 @@
|
|||
[
|
||||
{
|
||||
"name": "show vars",
|
||||
"when": "switch_show_vars",
|
||||
"ansible.builtin.debug": {
|
||||
"var": "vars.cfg_tlscert_selfsigned"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "install packages",
|
||||
"become": true,
|
||||
|
|
@ -28,19 +35,19 @@
|
|||
"name": "csr | generate private key",
|
||||
"become": true,
|
||||
"community.crypto.openssl_privatekey": {
|
||||
"path": "/etc/ssl/private/{{var_tlscert_selfsigned_domain}}.pem"
|
||||
"path": "/etc/ssl/private/{{cfg_tlscert_selfsigned.domain}}.pem"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "csr | execute",
|
||||
"become": true,
|
||||
"community.crypto.openssl_csr": {
|
||||
"privatekey_path": "/etc/ssl/private/{{var_tlscert_selfsigned_domain}}.pem",
|
||||
"common_name": "{{var_tlscert_selfsigned_domain}}",
|
||||
"privatekey_path": "/etc/ssl/private/{{cfg_tlscert_selfsigned.domain}}.pem",
|
||||
"common_name": "{{cfg_tlscert_selfsigned.domain}}",
|
||||
"subject_alt_name": [
|
||||
"DNS:{{var_tlscert_selfsigned_domain}}"
|
||||
"DNS:{{cfg_tlscert_selfsigned.domain}}"
|
||||
],
|
||||
"path": "/etc/ssl/csr/{{var_tlscert_selfsigned_domain}}.pem"
|
||||
"path": "/etc/ssl/csr/{{cfg_tlscert_selfsigned.domain}}.pem"
|
||||
},
|
||||
"register": "temp_csr"
|
||||
},
|
||||
|
|
@ -48,17 +55,17 @@
|
|||
"name": "generate certificate",
|
||||
"become": true,
|
||||
"community.crypto.x509_certificate": {
|
||||
"privatekey_path": "/etc/ssl/private/{{var_tlscert_selfsigned_domain}}.pem",
|
||||
"csr_path": "/etc/ssl/csr/{{var_tlscert_selfsigned_domain}}.pem",
|
||||
"privatekey_path": "/etc/ssl/private/{{cfg_tlscert_selfsigned.domain}}.pem",
|
||||
"csr_path": "/etc/ssl/csr/{{cfg_tlscert_selfsigned.domain}}.pem",
|
||||
"provider": "selfsigned",
|
||||
"path": "/etc/ssl/certs/{{var_tlscert_selfsigned_domain}}.pem"
|
||||
"path": "/etc/ssl/certs/{{cfg_tlscert_selfsigned.domain}}.pem"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "compose fullchain",
|
||||
"become": true,
|
||||
"ansible.builtin.shell": {
|
||||
"cmd": "cat /etc/ssl/certs/{{var_tlscert_selfsigned_domain}}.pem > /etc/ssl/fullchains/{{var_tlscert_selfsigned_domain}}.pem"
|
||||
"cmd": "cat /etc/ssl/certs/{{cfg_tlscert_selfsigned.domain}}.pem > /etc/ssl/fullchains/{{cfg_tlscert_selfsigned.domain}}.pem"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
|
|||
179
tools/cfg-man
Executable file
179
tools/cfg-man
Executable file
|
|
@ -0,0 +1,179 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import os as _os
|
||||
import sys as _sys
|
||||
import json as _json
|
||||
import argparse as _argparse
|
||||
|
||||
|
||||
def convey(
|
||||
x,
|
||||
fs
|
||||
):
|
||||
y = x
|
||||
for f in fs:
|
||||
y = f(y)
|
||||
return y
|
||||
|
||||
|
||||
def file_read(
|
||||
path
|
||||
):
|
||||
handle = open(path, "r")
|
||||
content = handle.read()
|
||||
handle.close()
|
||||
return content
|
||||
|
||||
|
||||
class interface_option(object):
|
||||
def is_filled(self):
|
||||
raise NotImplementedError()
|
||||
def cull(self):
|
||||
raise NotImplementedError()
|
||||
def propagate(self, function):
|
||||
raise NotImplementedError()
|
||||
|
||||
|
||||
class class_option_empty(interface_option):
|
||||
def __init__(self):
|
||||
pass
|
||||
def is_filled(self):
|
||||
return False
|
||||
def cull(self):
|
||||
raise ValueError("cull from empty")
|
||||
def propagate(self, function):
|
||||
return class_option_empty()
|
||||
|
||||
|
||||
class class_option_filled(interface_option):
|
||||
def __init__(self, value):
|
||||
self.value = value
|
||||
def is_filled(self):
|
||||
return True
|
||||
def cull(self):
|
||||
return self.value
|
||||
def propagate(self, function):
|
||||
return function(self.value)
|
||||
|
||||
|
||||
def generate_defaults(
|
||||
schema_node
|
||||
):
|
||||
if ("anyOf" in schema_node):
|
||||
## todo: o'rly?
|
||||
return generate_defaults(schema_node["anyOf"][0])
|
||||
else:
|
||||
if (not ("type" in schema_node)):
|
||||
raise ValueError(":?")
|
||||
else:
|
||||
if (not (schema_node["type"] == "object")):
|
||||
if (not ("default" in schema_node)):
|
||||
return class_option_empty()
|
||||
else:
|
||||
return class_option_filled(schema_node["default"])
|
||||
else:
|
||||
result = {}
|
||||
for (key, value, ) in schema_node["properties"].items():
|
||||
sub_result = generate_defaults(value)
|
||||
if (not sub_result.is_filled()):
|
||||
pass
|
||||
else:
|
||||
result[key] = sub_result.cull()
|
||||
return class_option_filled(result)
|
||||
|
||||
|
||||
def generate_overrides(
|
||||
schema_node
|
||||
):
|
||||
if ("anyOf" in schema_node):
|
||||
## todo: o'rly?
|
||||
return generate_overrides(schema_node["anyOf"][0])
|
||||
else:
|
||||
if (not ("type" in schema_node)):
|
||||
raise ValueError(":?")
|
||||
else:
|
||||
if (not (schema_node["type"] == "object")):
|
||||
if ("default" in schema_node):
|
||||
return class_option_empty()
|
||||
else:
|
||||
if ("enum" in schema_node):
|
||||
return class_option_filled(schema_node["enum"][0])
|
||||
else:
|
||||
if (schema_node.get("nullable", False)):
|
||||
return class_option_filled(None)
|
||||
else:
|
||||
if (schema_node["type"] == "boolean"):
|
||||
return class_option_filled(False)
|
||||
elif (schema_node["type"] == "integer"):
|
||||
return class_option_filled(0)
|
||||
elif (schema_node["type"] == "number"):
|
||||
return class_option_filled(0)
|
||||
elif (schema_node["type"] == "string"):
|
||||
return class_option_filled("")
|
||||
else:
|
||||
raise ValueError("unhandled type: %s" % schema_node["type"])
|
||||
else:
|
||||
result = {}
|
||||
for (key, value, ) in schema_node["properties"].items():
|
||||
sub_result = generate_overrides(value)
|
||||
if (not sub_result.is_filled()):
|
||||
pass
|
||||
else:
|
||||
result[key] = sub_result.cull()
|
||||
return (
|
||||
class_option_empty()
|
||||
if (len(result) <= 0) else
|
||||
class_option_filled(result)
|
||||
)
|
||||
|
||||
|
||||
def role_name_derive(
|
||||
role_name
|
||||
):
|
||||
return role_name.replace("-", "_")
|
||||
|
||||
|
||||
def main(
|
||||
):
|
||||
## args
|
||||
argument_parser = _argparse.ArgumentParser()
|
||||
argument_parser.add_argument(
|
||||
"action",
|
||||
type = str,
|
||||
choices = [
|
||||
"defaults",
|
||||
"overrides",
|
||||
],
|
||||
metavar = "<action>",
|
||||
)
|
||||
argument_parser.add_argument(
|
||||
"role",
|
||||
type = str,
|
||||
metavar = "<role>",
|
||||
)
|
||||
args = argument_parser.parse_args()
|
||||
|
||||
## exec
|
||||
cfg_schema = convey(
|
||||
args.role,
|
||||
[
|
||||
lambda x: _os.path.join("roles", x, "cfg.schema.json"),
|
||||
file_read,
|
||||
_json.loads,
|
||||
]
|
||||
)
|
||||
if args.action == "defaults":
|
||||
raw = generate_defaults(cfg_schema)
|
||||
key = ("cfg_%s_defaults" % (role_name_derive(args.role)))
|
||||
result = {key: (raw.cull() if raw.is_filled() else {})}
|
||||
_sys.stdout.write(_json.dumps(result, indent = "\t") + "\n")
|
||||
elif args.action == "overrides":
|
||||
raw = generate_overrides(cfg_schema)
|
||||
key = ("cfg_%s_overrides" % (role_name_derive(args.role)))
|
||||
result = {key: (raw.cull() if raw.is_filled() else {})}
|
||||
_sys.stdout.write(_json.dumps(result, indent = "\t") + "\n")
|
||||
else:
|
||||
raise ValueError("invalid action: %s" % args.action)
|
||||
|
||||
|
||||
main()
|
||||
Loading…
Reference in a new issue