1491 Commits

Author SHA1 Message Date
Sunil Mohan Adapa
2c721659f4
backups: Un-mount SSH repositories before deleting them
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2019-07-03 12:45:28 +05:30
Sunil Mohan Adapa
6821d73025
backups: Minor cleanup
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2019-07-03 12:45:20 +05:30
Sunil Mohan Adapa
dd5d93637f
backups: Don't send passphrase on the command line
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2019-07-03 12:44:54 +05:30
Sunil Mohan Adapa
fa3e2ea86b
backups: Fix issue with verifying SSH host keys
Ensure that the fingerprint accepted is the one verified by user. If they
fingerprints and public keys are retrieved separately, there is chance that what
was verified by the user is not what is added to the known hosts file.

- Avoid creating a temporary file when fetching keys

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2019-07-03 12:44:43 +05:30
Sunil Mohan Adapa
463c620c65
backups: Remove known_hosts file from config file
- There is no compelling reason to make the file configurable. Simplifies
  configuration file if we make it relative to FreedomBox data directory.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2019-07-03 12:44:34 +05:30
Sunil Mohan Adapa
76efccce37
backups: Fix and refactor adding a new remote repository
- Fix encrypted repositories getting created without encryption.

- Set verified=False by during save operation for safety.

- Handle common error scenarios and show proper messages. Such as authentication
  failure.

- Use pathlib to simplify file handling code.

- Split nested code for readability and do better function splits.

- Expand ~ only if it is at the beginning of the path.

- Allow empty repository path as allowed by SSH.

- Don't internationalize log messages.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2019-07-03 12:44:18 +05:30
Sunil Mohan Adapa
f2ea0b9065
backups: Require passphrase for encryption in add repository form
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2019-07-03 12:44:09 +05:30
Sunil Mohan Adapa
2a2cc41f1d
backups: Handle SSH keys for old stored repositories
- Assume that their SSH public keys are not unverified.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2019-07-03 12:44:01 +05:30
Sunil Mohan Adapa
661a00198e
backups: Minor styling changes
- Add docstrings.

- Add blank lines for extra readability.

- Use <span> instead of <i> tag for icon in template.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2019-07-03 12:43:49 +05:30
Sunil Mohan Adapa
984b7dca88
backups: Cleanup auto-mounting SSH repositories
Remove auto-mounting of repositories during instantiation entirely. It is better
to explicitly mount later.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2019-07-03 12:43:40 +05:30
Sunil Mohan Adapa
9c8674baa3
backup: Allow SSH directory paths with : in them
- From SSH manual, a path may contain : if it is presented as absolute path.
  Update regular expression for splitting accordingly.

- Allow Null paths similar to SSH.

- Perform a full regular expression match when splitting path.

- Simplify regular expression.

- Update tests.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2019-07-03 12:43:28 +05:30
Sunil Mohan Adapa
c8a292d308
backups: Minor fixes to host verification view template
- Remove <br> tags. They have no semantics and should be replaced with uniform
  styling.

- Minor changes to messages.

- Remove <p> tags from internationalized messages.

- Rename button label from ' Verify ' to 'Verify Host'. Extra spaces are
  incorrect.

- Fix indentation.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2019-07-03 12:43:12 +05:30
Joseph Nuthalapati
bd1874d774
backups: Add regex validation for ssh_repository field
Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2019-07-03 12:43:08 +05:30
Joseph Nuthalapati
2c97e1e02e
backups: Read file path of known_hosts directly from plinth.config
Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2019-07-03 12:43:02 +05:30
Joseph Nuthalapati
795ed9d735
backups: Remove unnecessary context manager for paramiko SFTPClient
Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2019-07-03 12:42:56 +05:30
Joseph Nuthalapati
9f71c5867e
ui: Create reusable CSS class for collapsible-button
.collapsible-button is used by both "Client Apps" and the "How to verify?"
button in backups:verify-ssh-hostkey page.

Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2019-07-03 12:42:48 +05:30
Joseph Nuthalapati
3a6dcbe7a7
Verify SSH hostkey before mounting
Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2019-07-03 12:42:41 +05:30
Joseph Nuthalapati
de7275d4a5
backups: ssh remotes: Refactoring
- Make url scheme consistent
- Add an FA icon to the drop-down button in VerifySshHostkeyView
- Refactoring to reduce code duplication

Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2019-07-03 12:42:31 +05:30
Joseph Nuthalapati
0b43caf81d
Add SSH hostkey verification
Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2019-07-03 12:42:25 +05:30
Joseph Nuthalapati
f85e7829b9
backups: tests: Fix issue with usage of fixture 'needs_root'
Fixtures cannot be currently included into other fixtures by using
@pytest.mark.fixtures('fixture_name')
They have to be included as parameters instead.
See bug: https://github.com/pytest-dev/pytest/issues/3664

Also increase the scope of needs_root to the highest, i.e. session, so that it
can be used by any kind of fixture.

Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2019-07-03 12:42:20 +05:30
Joseph Nuthalapati
f4f9e2c465
backups: Skipping tests temporarily
Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2019-07-03 12:42:14 +05:30
Joseph Nuthalapati
ee21dcfbb8
backups: Avoid using sudo in tests
Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2019-07-03 12:42:10 +05:30
Joseph Nuthalapati
d451b54286
backups: Add test for adding ssh remotes
Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2019-07-03 12:42:02 +05:30
Joseph Nuthalapati
95f9f5c712
backups: Minor refactoring in forms.py
Break up clean() into multiple private methods

Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2019-07-03 12:41:56 +05:30
Joseph Nuthalapati
56babf5cb4
backups: Fix issue with repository not being initialized
Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2019-07-03 12:41:48 +05:30
Joseph Nuthalapati
67404a1c2d
backups: Make paramiko a dependency of freedombox package
Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2019-07-03 12:41:28 +05:30
Joseph Nuthalapati
3270ba875a
backups: Text change on index page
Change heading text to "Existing backup locations" in backups index page.

Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2019-07-03 12:41:18 +05:30
Joseph Nuthalapati
cbb177414f
backups: YAPF formatting
Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2019-07-03 12:41:11 +05:30
Joseph Nuthalapati
fb67c60a84
backups: Avoid creating duplicate SSH remotes
Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2019-07-03 12:40:51 +05:30
Joseph Nuthalapati
e618e08fe7
backups: Improve UX of adding ssh remote
- Create empty directory if not exists
- Check if the directory is empty
  - if not empty, check if it's an existing backup repository
  - else throw an error

Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2019-07-03 12:40:35 +05:30
Doma Gergő Mihály
d0c9d542f2
matrixsynapse: Fix missing translation mark
Missing translation mark in "matrix-synapse.html" fixed. Closes: #1588.

Signed-off-by: Doma Gergő Mihály <domag02@gmail.com>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-07-02 10:12:05 -07:00
Sunil Mohan Adapa
c6bbc847b4
syncthing: Open firewall ports for listening and discovery
- Closes #1592.

- Use firewall service definition 'syncthing' already available.

- Open externally also, helps in syncing with peers on the Internet. Open
  discovery port also externally and syncthing deal with the traffic.

- Based on https://docs.syncthing.net/users/firewall.html

Test:

- Install version 2, syncthing firewall service is enabled in internal and
  external zones.

- Disable app, syncthing firewall service is removed. Enable app, syncthing
  firewall service is added.

- Install version 1, upgrade to version 2, syncthing firewall service is added.

- Install version 1, disable syncthing, upgrade to version 2, syncthing firewall
  service is not added. Enable syncthing, firewall service is added.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-06-24 18:11:35 -04:00
Sunil Mohan Adapa
23f37a3a3d
app: Set app as enabled only when the daemon is enabled
- For avahi, datetime and SSH.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-06-13 20:18:08 -04:00
Sunil Mohan Adapa
e4351b6b97
Introduce daemon component to handle systemd units
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-06-13 20:18:02 -04:00
Sunil Mohan Adapa
46f162d093
app: Add unique ID to each app class
Also maintain a global list of apps

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-06-13 20:17:59 -04:00
Sunil Mohan Adapa
e55a85bdd1
app: Rename get() method to get_component()
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-06-13 20:17:56 -04:00
Sunil Mohan Adapa
862d87920a
Introduce uwsgi component to manage uWSGI configuration
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-06-13 20:17:53 -04:00
Sunil Mohan Adapa
4100d36381
Introduce webserver component for managing Apache configuration
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-06-13 20:17:49 -04:00
Sunil Mohan Adapa
ca2c7dbeb0
Introduce firewall component for opening/closing ports
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-06-13 20:17:45 -04:00
James Valleroy
1600c25ae8
monkeysphere: Hide by default
Update functional test to show advanced apps.

Closes #1453.

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-06-10 11:16:01 -07:00
James Valleroy
ff06c722bb
config: Add option to show advanced apps
Closes #1454.

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-06-10 11:15:58 -07:00
James Valleroy
5fe7f4aaba
searx: Update to use shortcut component
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
2019-06-09 10:40:58 -04:00
Joseph Nuthalapati
7e1e5182cc
searx: Preserve public_access setting
- Preserve the setting during enable/disable as well as during backup/restore.
- Show setting as disabled when application is disabled but restore user's
  original preference value on enable.
- Add functional test for this.

Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-06-09 10:40:49 -04:00
Joseph Nuthalapati
2d85b61199
searx: Add option to allow public access to the application
[jvalleroy] Resolved merge conflict to use shortcut component.

Fixes #1590

Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-06-09 10:37:16 -04:00
James Valleroy
6a9133c305
config: Update migration to use app id
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
2019-06-08 22:50:20 -04:00
Sunil Mohan Adapa
75c57d3e00
Turn frontpage shortcut into an app component
- Turn frontpage shortcut into an App component. Add tests and full
  documentation.

- Overridden implementations for tahoe, diaspora, mediawiki shortcuts to handle
  special cases. Special handling for ikiwiki.

- Extend App API for removing and retrieving a component.

- Add clients information into shortcuts to avoid hacks when presenting
  shortcuts to Mobile devices via API.

- Fixed unnecessary stripping and adding of '/' when setting home page redirect
  URLs. This fixes problem with setting Cockpit as home page.

- Replaced the use of term 'app' in favor of 'shortcut' as the term when setting
  frontpage shortcuts as home page.

- JSXC shortcut does not require login.

- Don't show shadowsocks for anonymous users.

- Simplify showing selected shortcut details.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-06-07 11:48:08 -07:00
Sunil Mohan Adapa
b96d901071
Introduce component architecture and menu component
- Introduce base class for all apps that will contain components. With
  unittests.

- Introduce base classes for components. With unittests.

- Turn Menu class into an app component.

  - Further cleanup Menu class.

  - Update tests.

  - Maintain a global list of menu items and look them up easily. Generalize
    such that subsubmenus can later be merged into Menu class.

  - Cleanup scope of main menu initialization.

  - Use None instead of empty strings for various values. Ensure that
    printing short_description does not show 'None' in output.

  - Use enable/disable instead of promote/demote.

- Use menu component in all apps.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-06-07 11:48:04 -07:00
Sunil Mohan Adapa
eb72c8cbf5
ssh: Show port forwarding information
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-05-13 15:54:36 -07:00
Sunil Mohan Adapa
3a0b2cbc01
bind: Show port forwarding information
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-05-13 15:54:30 -07:00
Sunil Mohan Adapa
4bfb1accfb
i2p: Show port forwarding information
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-05-13 15:54:24 -07:00