1592 Commits

Author SHA1 Message Date
Sunil Mohan Adapa
5b01689a92
backups: Clarify two separate uses of name create_repository
It is being used to mean initialize the borg repository as well as creating an
instance of the repository class object. Use 'initialize' for former and
'get_instance' for latter.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-09-07 12:52:46 -04:00
Sunil Mohan Adapa
6c14e34875
backups: Implement hostname property on SSH repository
Use repository class instances instead of custom ad-hoc data structures such as
repo_data.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-09-07 12:52:44 -04:00
Sunil Mohan Adapa
0eb2db3f9a
backups: Use higher level method in views instead of store methods
Make store an internal implementation detail of the repository class and achieve
better abstraction.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-09-07 12:52:41 -04:00
Sunil Mohan Adapa
143c9e494d
backups: Make mountpoint property private
It is not required by any consumers. Allows for better abstraction on a complex
class.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-09-07 12:52:39 -04:00
Sunil Mohan Adapa
d05bbab751
backups: Rename repo_path to borg_path for clarity
borg_path clearly signifies that it is to be used by borg and consumers of the
class will not be confused by it.

Also rename some repo_path variables in test cases.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-09-07 12:52:36 -04:00
Sunil Mohan Adapa
5865fbea26
backups: Minor change to disk repository name
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-09-07 12:52:33 -04:00
Sunil Mohan Adapa
68fed450a9
backups: Rename remove_repository method to remove
Since the method is being called on Repository classes, _repository suffix is
redundant.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-09-07 12:52:30 -04:00
Sunil Mohan Adapa
461741c33f
backups: Expose repository path as property
Make consumers depend on the repository classes instead of lower level store
API.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-09-07 12:52:27 -04:00
Sunil Mohan Adapa
e8b324eece
backups: Minor cosmetic fixes
- Remove some pylint warnings

- Add documentation strings.

- Yapf auto-formatting.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-09-07 12:52:22 -04:00
Sunil Mohan Adapa
0b0791d78f
backups: Introduce method for checking if a repository is usable
get_repositories method will return repositories instead of dictionaries for
view content. This will make it usable in more situations.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-09-07 12:52:20 -04:00
Sunil Mohan Adapa
0df07f5cf2
backups: Rename network_storage module to store
Same module is being used to store/retrieve local disk repositories also.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-09-07 12:52:17 -04:00
Sunil Mohan Adapa
5df34d1927
backups: Simplify listing repositories in index page
- Use sort_order property to decide which type of repositories should be listed
  first.

- Remove getting repositories of a given type and retrieve all of them at the
  same time.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-09-07 12:52:14 -04:00
Sunil Mohan Adapa
b5d7a910dd
backups: Simplify checking repository capabilities using flags
Also make storage_type an abstract property so that derived classes are forced
to override it.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-09-07 12:52:11 -04:00
Sunil Mohan Adapa
5136304212
backups: Fix removing local repository
- Remove incorrect instantiation of SSH repository for local disk repositories.

- Clarify the removal message to convey that backups are not removed.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-09-07 12:52:08 -04:00
Sunil Mohan Adapa
92abe9f3c1
backups: Remove cancel button from add disk location page
For consistency with add remote location page.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-09-07 12:52:05 -04:00
Sunil Mohan Adapa
925df966f3
backups: Add missing slashes at the end of URLs
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-09-07 12:52:01 -04:00
Joseph Nuthalpati
de4a019063
backups: Save new backup location to plinth database
Signed-off-by: Joseph Nuthalapati <njoseph@riseup.net>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-09-07 12:51:58 -04:00
Joseph Nuthalpati
7c7ad6d56a
backups: Refactor class hierarchy in repository.py
- Reduce repetition between various kinds of BorgBackup repositories

Signed-off-by: Joseph Nuthalapati <njoseph@riseup.net>
[sunil@medhas.org Undo blank line removals]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-09-07 12:51:54 -04:00
Joseph Nuthalpati
8a93b5b90c
backups: Allow adding backup repositories on multiple disks
Signed-off-by: Joseph Nuthalapati <njoseph@riseup.net>
[sunil@medhas.org Fix showing form choices, undo blank line removals]
[sunil@medhas.org Fix typo in tooltip for add repo button]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-09-07 12:51:40 -04:00
Sunil Mohan Adapa
5fbc3fc31f
help: Make download as PDF a regular button
By creating an icon for 'download as pdf', we are introducing a completely new
class of buttons into FreedomBox UI. While not being essential, this causes more
learning for the user. Further, it does not exhibit the regular behavior of a
button such as hover styling and button text.

Change the icon into a regular button that user is familiar with elsewhere. Also
add label text.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Joseph Nuthalapati <njoseph@riseup.net>
2019-09-07 10:51:05 +05:30
Danny Haidar
6e5791ca0c
help: Minor updates to the statements on contribute page
See https://salsa.debian.org/freedombox-team/plinth/issues/1517#note_108382

Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-09-06 12:43:55 -07:00
Joseph Nuthalapati
7ec0ee3163
manual: Move PDF download link to HTML manual page
- Remove "Download Manual" card
- Create link to download manual in the header of the HTML manual

Signed-off-by: Joseph Nuthalapati <njoseph@riseup.net>
[sunil@medhas.org Remove hard-coded URL for manual download]
[sunil@medhas.org Fix CSS indentation]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-09-06 11:07:04 -07:00
Sunil Mohan Adapa
b91f0fb4d0
help: Add more text to contribute page for donations
From original discussion in
https://salsa.debian.org/freedombox-team/plinth/issues/1517#note_69698

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-08-30 16:25:02 -07:00
Joseph Nuthalapati
b484dcb301
help: Add button for Contribute
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-08-30 16:24:59 -07:00
Joseph Nuthalapati
519b573e9f
help: Add button for Support
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-08-30 16:24:56 -07:00
Joseph Nuthalapati
35fb7c4e0e
help: Add button to submit feedback
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-08-30 16:24:49 -07:00
Sunil Mohan Adapa
798e775038
storage: Fix regression with restoring backups with storage
Regression was introduced in a2d07fef0b9e2ae54f98fb5209b9cb0c5fd6f456 when
backup data import from manifest was inadvertently removed.

Closes: #1636.

Test:

  Create a backup with this patch and 'storage' as one of the selected apps for
  backup. Try to restore the backup without the patch. Observe that it fails.
  Restore the backup with the patch. Observe that it succeeds.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-08-26 18:31:12 -04:00
Sunil Mohan Adapa
68bc333842
updates: Allow matrix-synapse 1.3 to be installed for buster users
- matrix-synapse 1.2 is already unavailable in buster-backports, testing and
  unstable. It is replaced by matrix-synapse 1.3. Allow matrix-synapse 1.3 to
  become available for Buster users.

- Allow upgrades to all future versions of matrix-synapse from buster-backports.
  Since buster-backports does not have security updates except that provided
  by the maintainer, it is best to let users be on the latest version provided
  by the maintainer in buster-backports.

- We don't pick and choose among the versions uploaded to backports. Once we
  allow a package to upgrade to backports version, we should continue to do that
  without any further restriction. Update descriptions accordingly.

- Simplify updating the apt preferences file by providing a simple configuration
  instead of creating the file on the fly.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-08-25 17:41:58 -04:00
Sunil Mohan Adapa
a66d50fb89
users: Cosmetic yapf and isort fixes
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-08-25 15:52:15 -04:00
Sunil Mohan Adapa
2317e6bd94
users: Minor fix to return value when getting last admin user
Tests:

- When only when admin user is present, the users list does not show delete
  button next to the admin user. The checkbox for admin group is disabled (but
  checked) for that user in edit user form.

- When there are multiple admin users preset, the users list shows delete button
  against all admin users. The checkbox for admin group is enabled (but checked)
  for all admin users.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-08-25 15:52:12 -04:00
Sunil Mohan Adapa
e1e654554e
users: Minor cosmetic refactoring
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-08-25 15:52:06 -04:00
Sunil Mohan Adapa
b01ac54dd3
users: Don't delete 'admin' group when running unit tests
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-08-25 15:52:03 -04:00
Sunil Mohan Adapa
696ce3b6a5
matrixsynapse: Fix apache syntax errors introduce by 4b8b2e171c86d75
This reverts the additional changes done in merge request !1540 and sets the
configuration to what was originally proposed in the merge request.

- AllowEncodedSlashes can't be set inside <Location> directive. It needs to be
  set inside VirtualHost directive making it apply for the entire site. In case
  of FreedomBox, this needs to be set globally. It may have implications for how
  we are encoding slashes in URLs include for storage module. It could cause
  unexpected regressions elsewhere.

- ProxyPass directory should have only argument inside a <Location> directive.
  Fix that too.

Closes: #1635.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-08-25 15:15:20 -04:00
Sunil Mohan Adapa
20c97c5ce3
tt-rss: Force upgrade to 18.12-1.1 and beyond
Force upgrade to any lower version to version less than or equal to 19.8.*.

config.php is the only configuration file for tt-rss app the FreedomBox
modifies. Comparison of config.php from 19.8 shows that there are no major
changes since 18.12. Changes to the configuration file are likely to be minor
and from Debian packaging. Force upgrading to all versions until 19.8.* should
be okay by retaining new configuration and performing FreedomBox changes on top
everything new configuration file is installed.

Tests:

- Install tt-rss version 18.12-1 using a test repository and custom priority.
  Then remove the custom priority and trigger 'apt update'. This will trigger an
  force upgrade of tt-rss to version 18.12-1.1. Verify that the tt-rss interface
  is available and functional.

- Install tt-rss version 18.12-1.1 freshly. Verify that the tt-rss interface is
  available and functional.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-08-24 10:25:54 -04:00
bn4t
4b8b2e171c
matrix-synapse: Use recommended reverse proxy configuration
matrix-synapse reverse proxy configuration for Apache according to:
https://github.com/matrix-org/synapse/blob/master/docs/reverse_proxy.rst

Fixes #1533.

[sunil@medhas.org Fix closing location directive]
Tested-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-08-23 11:10:33 -07:00
Sunil Mohan Adapa
49088ef578
cockpit: Make essential and install by default
See reasoning in https://salsa.debian.org/freedombox-team/plinth/issues/1629

Closes: #1629

Closes: #1452 (obsolete)

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-08-21 21:35:28 -04:00
Sunil Mohan Adapa
0c08248c12
avahi: Expose .local domain as a proper domain
When a hostname is set or changed, expose <hostname>.local as a domain. With
this, daemons can configure themselves to work properly with .local domains.
Cockpit is an example of a daemon that can be configured to allow connections
from .local domains

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-08-21 21:35:25 -04:00
Sunil Mohan Adapa
3ba7e961c4
letsencrypt: Don't try to obtain certificates for .local domains
Replace the check for ignoring .onion domains with a check that ignore any
domain type that can't have certificates.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-08-21 21:35:22 -04:00
Sunil Mohan Adapa
855a99cc21
config: Send hostname change signal only after fully processing it
If the domain name is not properly set before calling post_hostname_change
signal, then in the signal handlers config.get_domainname() returns an empty
string. So, call the post_hostname_change signal only after fully finishing the
hostname related changes, that is, after setting back the original domain name
too.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-08-21 21:35:19 -04:00
Sunil Mohan Adapa
e8e2aaf85b
ejabberd: Prevent processing empty domain name
When domain name is not set in the config app, currently ejabberd return a list
with an empty string as list of domains. This leads to certificates being copied
to invalid directory. Fix this by making sure domain name is added to the list
only if it is not an empty string.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-08-21 21:35:16 -04:00
Sunil Mohan Adapa
c30b3eb85c
cockpit: Apply domain name changes immediately
Without restarting cockpit, newly added/removed domain in cockpit configuration
file do not immediately work. Either the daemon has to stop itself due to
inactivity (it is socket activated by systemd) or system needs to be restarted.
Without the patch, if cockpit is not currently running (due to socket activation
not having happened yet) the domain name changes would be noticeable
immediately.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-08-21 21:35:13 -04:00
Sunil Mohan Adapa
393f4bbc26
names: Perform better layout of domain names table on small screens
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Joseph Nuthalapati <njoseph@riseup.net>
2019-08-21 10:17:59 +05:30
James Valleroy
e157c1f463
security: Hide vulnerability table by default
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
[sunil@medhas.org Fix 'rol' attribute to 'role']
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-08-18 17:36:56 -07:00
Sunil Mohan Adapa
03dcaa57da
api: Fix regression with listing only enabled apps in mobile app
Closes: #1626

Tests:

- List apps in mobile app front page. Observe that all apps are shown including
  disabled apps.

- With the patch, observer that only enabled apps are shown.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-08-12 18:26:19 -04:00
Sunil Mohan Adapa
173d3464b0
config: Remove unused domain change signal
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-08-11 18:40:12 -04:00
Sunil Mohan Adapa
bd05c43d32
letsencrypt: Remove unused listen to domain change signal
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-08-11 18:40:09 -04:00
Sunil Mohan Adapa
012db6ac93
cockpit: Don't handle the domain changed signal
Domain added and removed signals provide sufficient knowledge of domain name
changes.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-08-11 18:40:08 -04:00
Sunil Mohan Adapa
0dba497383
ejabberd: Use domain added signal for listening to domain changes
In the action, the new domain is always extended to the list of domain names
accepted by ejabberd. To simplify domain handling simply use the domain_added
signal.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-08-11 18:40:06 -04:00
Sunil Mohan Adapa
ba8db1b4b5
letsencrypt: Fix problem with automatically obtaining certificates
When a domain is added, an attempt will be made to obtain a valid LE certificate
for domain.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-08-11 18:40:00 -04:00
Sunil Mohan Adapa
ba4afd2a09
names: Use new API in all apps
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-08-11 18:39:56 -04:00