6 Commits

Author SHA1 Message Date
Sunil Mohan Adapa
7175a05733
backups: Mark secret strings in privileged actions
Tests:

- Run affected privileged actions through UI and notice that secret strings are
not logged (except initializing init/info a new SSH repository).

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2024-08-11 12:57:45 -04:00
Benedek Nagy
8bafabe2f9
backup: Fix bug in adding existing unencryped backup location
borg throws and warning "Warning: Attempting to access a previously unknown
unencryped repository!\nDo you want to continue?" and then fails while asking
for a manual confirmation. Avoid this by telling borg not to prompt (and confirm
yes).

This commit provides a fix for the issue described here:

https://discuss.freedombox.org/t/how-do-i-restore-freedombox/2022/10

[sunil: Drop the part about handling the error message]
Signed-off-by: Benedek Nagy <contact@nbenedek.me>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2023-10-04 10:41:22 -07:00
Sunil Mohan Adapa
38ece87c6c
*: Utilize newer 3.10 syntax for type hints
Tests:

- mypy does not show any errors.

- Installing ejabberd app works. Privileged actions run fine.

- Unit tests work.

- No additional testing was done as type annotations don't have any effect at
runtime.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2023-09-25 20:03:34 -04:00
Sunil Mohan Adapa
2dd00a8f08
*: Fix all typing hint related errors
- Try to mark class variables in component classes.

- Leave typing hints generic, such as 'list' and 'dict' where content is usually
not filled, too complex, or context is unimportant.

- backups: Handle failure for tarfile extraction so that methods are not called
on potentially None valued variables.

- backups: Prevent potentially passing a keyword argument twice.

- dynamicdns: Deal properly with outcome of urlparsing.

- ejabberd: Deal with failed regex match

- email: Fix a mypy compliant when iterating a filtered list.

- tor: Don't reuse variables for different typed values.

- tor: Don't reuse variables for different typed values.

- operation: Return None explicitly.

- operation: Ensure that keyword argument is not repeated.

Tests:

- Where only typing hints were modified and no syntax error came up, additional
testing was not done.

- `mypy --ignore-missing-imports .` run successfully.

- Generate developer documentation.

- Service runs without errors upon start up.

- backups: Listing and restoring specific apps from a backup works.

- backups: Mounting a remote backup repository works.

- NOT TESTED: dynamicdns: Migrating from old style configuration works.

- ejabberd: Verify that setting coturn configuration works.

- email: Test that showing configuration from postfix works.

- tor: Orport value is properly shown.

- transmission: Configuration values are properly set.

- users: Running unit tests as root works.

- operation: Operation status messages are show properly during app install.

- ./setup.py install runs

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2023-09-25 20:03:24 -04:00
Sunil Mohan Adapa
9a4905e832
backups: Use privileged decorator for backup actions
Tests:

- DONE: Functional tests works
- DONE: Initial setup works
  - DONE: Borg repository is created at /var/lib/freedombox/borgbackup
- DONE: With regular and with encrypted repository
  - DONE: Creating a repository works
  - DONE: Getting information works. When adding a existing location, incorrect
    password leads to error in the add form.
  - DONE: Listing archives works
  - DONE: Creating/restoring an archive works
    - DONE: Backup manifest is created in /var/lib/plinth/backups-manifests/
    - DONE: Including an app that dumps/restores its settings works
  - DONE: Exporting an archive as tar works
    - DONE: Exporting a large archive yields reasonable download speeds. 31
      MB/s. 1GB file in about 30 seconds.
  - DONE: Restoring from an uploaded archive works
  - DONE: Listing the apps inside an archive works before restore
- DONE: Errors during operations are re-raises as simpler errors
  - DONE: Get info
  - DONE: List archives
  - DONE: Delete archive (not handled)
  - FAIL: Export tar
  - DONE: Init repo
  - DONE: Get archive apps (not handled)

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-10-08 18:53:57 -04:00
Sunil Mohan Adapa
6072b1cea6
backups: Use privileged decorator for sshfs actions
Tests:

- Mounting an SSH repository works
  - If an known error is thrown during mounting, a simplified error is shown.
- Unmounting an SSH repository works
  - If an known error is thrown during mounting, a simplified error is shown.
- Correct status of whether the repository is mounted is shown.
  - If an known error is thrown during mounting, a simplified error is shown.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-10-08 18:53:44 -04:00