summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Fennell <matthew@fennell.dev>2024-01-26 18:38:23 +0000
committerMatthew Fennell <matthew@fennell.dev>2024-01-26 14:44:06 +0000
commit58ce069ae98a74ec95db89e8dda6e1ff188c3b77 (patch)
treedddc11599f08f008762ce58cfa10632865103d1a
parentf92d9d194c994b6347705b1eb9b7906b8c2a0943 (diff)
Add support for file upload
This commit adds support for XEPS 0065 and 0365 - i.e. sending files from one account to another.
-rw-r--r--README.md6
-rw-r--r--files/virtual_host.cfg.lua.j23
-rw-r--r--playbook.yaml20
3 files changed, 23 insertions, 6 deletions
diff --git a/README.md b/README.md
index 2defa3e..cb13e3a 100644
--- a/README.md
+++ b/README.md
@@ -36,6 +36,10 @@ the following DNS records:
| -------- | ---- | ---------- | --------- |
| A Record | @ | Static IP | Automatic |
+| Type | Host | Target | TTL |
+| ------------ | ------ | ----------- | --------- |
+| CNAME Record | upload | Root domain | Automatic |
+
See [Prosody's docs](https://prosody.im/doc/dns) for information on alternative
arrangements.
@@ -51,6 +55,8 @@ on the box itself will be taken care of by the playbook):
| XEP-0065 | TCP,UDP | 5000 |
| XMPP Client | TCP | 5222 |
| XMPP Server | TCP | 5269 |
+| HTTP Server | TCP | 5280 |
+| HTTP Server | TCP | 5281 |
### Install ansible on the control node
diff --git a/files/virtual_host.cfg.lua.j2 b/files/virtual_host.cfg.lua.j2
index 5f0c363..26058cb 100644
--- a/files/virtual_host.cfg.lua.j2
+++ b/files/virtual_host.cfg.lua.j2
@@ -3,3 +3,6 @@
-- SPDX-License-Identifier: AGPL-3.0-only
VirtualHost "{{ virtual_host }}"
+
+Component "upload.{{ virtual_host }}" "http_file_share"
+http_file_share_expires_after = 10 * 365 * 24 * 60 * 60
diff --git a/playbook.yaml b/playbook.yaml
index 8c53a57..48b482a 100644
--- a/playbook.yaml
+++ b/playbook.yaml
@@ -28,19 +28,27 @@
- WWW
- XMPP
become: true
- - name: Ensure port 5000/tcp is open for XEP-0065
+ - name: Ensure tcp ports are open for other XEPs
community.general.ufw:
rule: allow
- port: 5000
+ port: "{{ item }}"
proto: tcp
state: enabled
+ loop:
+ - 5000 # XEP-0065
+ - 5280 # XEP-0363
+ - 5281 # XEP-0363
become: true
- - name: Ensure port 5000/udp is open for XEP-0065
+ - name: Ensure udp ports are open for other XEPs
community.general.ufw:
rule: allow
- port: 5000
+ port: "{{ item }}"
proto: udp
state: enabled
+ loop:
+ - 5000 # XEP-0065
+ - 5280 # XEP-0363
+ - 5281 # XEP-0363
become: true
- name: Ensure certbot on-renew hook is installed
ansible.builtin.copy:
@@ -53,8 +61,8 @@
- name: Ensure certificates are installed
ansible.builtin.command: >-
certbot --non-interactive --agree-tos --post-hook "/bin/true"
- --email {{ certbot_email }} --no-eff-email --apache
- --domains {{ virtual_host }}
+ --email {{ certbot_email }} --no-eff-email --expand --apache --keep
+ --domains {{ virtual_host }},upload.{{ virtual_host }}
become: true
register: certbot
changed_when: "'Running post-hook command' in certbot.stdout"