1333 Commits

Author SHA1 Message Date
Kirill Schmidt
532aaf1489
first_boot: Use session to verify first boot welcome step
Closes: #2074

sunil's changes:

- Ensure that secret is not asked for a second time after creating admin user
and logging in (this happens due to discarding of old session and creating new
one).

- Ensure that this logic is not applied to user using FreedomBox images who are
not required to input the first wizard secret.

- Change the name of the session variable for readability.

Tests performed:

- Without the patch, start first boot wizard on the first browser on a
  FreedomBox image (or run the file `base64 < /dev/urandom | head -c 16 | sed -e
  's+$+\n+' > /var/lib/plinth/firstboot-wizard-secret`). Finish the welcome step
  with first wizard secret. Then open a second browser or from another computer
  visit the web interface. The first wizard secret is not asked and user can
  create an admin account.

- Repeat with fresh image again with the patch. To mimic fresh image, one may
  run `sudo rm -f /var/lib/plinth/plinth.sqlite3` and `echo "password" | | sudo
  /freedombox/actions/users remove-user tester`. This time when a different
  browser other than the one that provided the first wizard secret try to access
  the account creation page, a redirection will occur to welcome page. Providing
  the first wizard secret takes the user to account creation page.

- Accessing network first wizard page or internal pages on second browser also
  takes one back to the welcome page.

- Accessing help pages from second browser requires login.

- Accessing account login page from second browser is allowed. After creating
  the account from first browser, second browser can login and continue the
  wizard.

- Clearing cookies in the middle of the wizard takes the user back to welcome
  page.

- Clear cookies in the middles of the wizard. Visit the wizard, go to first boot
  welcome page. Provide secret and the wizard will continue where it was left
  off.

- Clear cookies in the middles of the wizard. Visit the wizard, go to first boot
  welcome page. Access login page, login as admin. Then first wizard secret is
  not asked. First wizard can be continued.

- On a fresh image, simply complete the first wizard. No change to earlier flow
  is noticed. First wizard secret is only asked once at the beginning.

- On a fresh image, remove the file /var/lib/plinth/firstboot-wizard-secret.
  First wizard can be completed without the secret.

[sunil: improvements to original patch by Kirill Schmidt]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
Tested-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-03-30 21:07:51 -04:00
Sunil Mohan Adapa
e448ab6380
matrixsynapse: Better checking for valid certificate
If a valid certificate is available but not yet setup, the earlier code assumes
there is a valid certificate.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-02-13 19:34:04 -08:00
Sunil Mohan Adapa
ee38f32f2b
letencrypt: Fix issue with disabling matrixsynapse checkbox
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-02-13 15:40:47 -08:00
Sunil Mohan Adapa
781ac3d5dd
matrixsynapse: Fix issues with showing certificate warning
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-02-13 15:40:05 -08:00
Sunil Mohan Adapa
3961ccf415
matrixsynapse: Remove hard-coded URL
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-02-13 15:38:45 -08:00
Joseph Nuthalapati
a918f9a885
matrix-synapse: Use Let's Encrypt certificates
Matrix requires valid certificates for federation with other servers from
version 1.0 onward. If the FreedomBox server already has LE cert and private
key, copy them into /etc/matrix-synapse

- Add certificate renewal hooks for Matrix Synapse. Reusing the certificate
  renewal mechanism built for ejabberd with matrix-synapse as well. One notable
  difference is that Matrix Synapse doesn't support switching the domain name or
  dropping the Let's Encrypt certificate.

- Use self-signed certificate if there is no LE certificate. Matrix Synapse
  server startup fails if the files homeserver.tls.crt and homeserver.tls.key
  are missing.

- Copy Apache's snakeoil certificates to /etc/matrix-synapse when LE
  certificates are not available. Prefer LE certificates if available.

- Display warning if no valid LE certificate is found.

Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2019-02-13 11:29:36 -08:00
Sunil Mohan Adapa
a821517e91
radicale: Simplify upgrading to newer packages
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-02-13 06:42:55 -05:00
James Valleroy
6536e86b15
radicale: Fix server URLs in client info
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-02-11 13:56:08 -08:00
James Valleroy
5aa957c6ba
radicale: Remove obsolete diagnostics
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-02-11 13:56:02 -08:00
James Valleroy
03b935333f
radicale: Bump version to 2
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-02-11 13:55:56 -08:00
James Valleroy
11e86cf8f8
radicale: Log errors during upgrade
Avoid raising errors which could cause endless loop of setup process
failing.

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-02-11 13:55:25 -08:00
Sunil Mohan Adapa
ab64bd17a3
apache: Switch to mod_ssl from mod_gnutls
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-02-09 12:28:09 -05:00
Sunil Mohan Adapa
49640fdfce
monkeysphere: Fix handling of multiple domains and keys
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-02-09 12:27:57 -05:00
J. Carlos Romero
722fa39c2a
mldonkey: Add to the description the three available front-ends
Signed-off-by: J. Carlos Romero <juancarlos.romero@gmail.com>
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-02-07 22:05:06 -08:00
J. Carlos Romero
59e41927bf
mldonkey: Add some more clients to the module page
Signed-off-by: J. Carlos Romero <juancarlos.romero@gmail.com>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-02-07 22:05:03 -08:00
James Valleroy
779ccb3bca
datetime: Switch from chrony to systemd-timesyncd
Previously, we switched from ntp to chrony. However, since chrony
conflicts with ntp, this change in dependency causes
unattended-upgrades to skip upgrading freedombox.

Switch to systemd-timesyncd, which does not conflict with either
package. We can switch back to chrony after all users have upgraded to
the most recent release.

Closes #1486

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-02-07 16:32:35 -08:00
Sunil Mohan Adapa
6e188524e2
backups: Fix styling for upload size warning
Make it conditional such that when the disk space information is not available
due to errors, we don't display the warning.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-02-07 19:12:06 -05:00
Sunil Mohan Adapa
ff8d85a88f
backups: Add link to manual page
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-02-07 19:12:04 -05:00
Sunil Mohan Adapa
f15505e6f4
backups: Add title and description to other pages
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-02-07 19:12:02 -05:00
Sunil Mohan Adapa
3be15a87e6
backups: Move subsubmenu below description
Closes: #1466.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-02-07 19:11:59 -05:00
Sunil Mohan Adapa
8da5b21d80
backups: Use icon for add repository button
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-02-07 19:11:57 -05:00
Sunil Mohan Adapa
d99c356336
backups: Rename 'Abort' buttons to 'Cancel'
Like most other pages in the interface, use 'Cancel' buttons instead of 'Abort'
buttons.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-02-07 19:11:53 -05:00
Joseph Nuthalapati
df978ce8ee
letsencrypt: UI: Fix checkbox disabling
Disable checkboxes using HTML attribute instead of CSS class

Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-02-07 15:23:01 -08:00
Sunil Mohan Adapa
3173c70743
datetime: Fix diagnostic test to not ignore first two servers
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-02-05 15:39:22 -08:00
James Valleroy
2c7d1a09c1
datetime: Switch from ntp to chrony
Use the default config, which only runs as client.

Fixes #971

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
2019-02-05 15:21:31 -08:00
Sunil Mohan Adapa
5a159f7d39
upgrades: Improve handling of backports
- Merge backports functionality into upgrades module.

- No need to enable systemd timer as dh_installsystemd automatically enables
  this during package installation and upgrade.

- Use https:// and deb.debian.org for repository checking. When using Tor for
  package installations request the URL via Tor.

- Make daily checking service more generic for all kind of future apt repository
  updates.

- Force removal of repository file during purge to avoid failures.

- Don't add contrib/non-free as backports is intended to be enabled for just the
  freedombox package and it is free. When the need arises, we can introduce
  contrib/non-free. This also eliminates an issue that adding these components
  doesn't work without the usage of tor.

- Allow generate apt preferences file to avoid lintian complaining about its
  presence. Remove on purge.

- Add unattended upgrades origin pattern to allow it to upgrade from backports
  repositories.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-02-05 14:58:55 -08:00
Sunil Mohan Adapa
2565737f38
tor: Make a utility method public
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-02-05 14:58:48 -08:00
Joseph Nuthalapati
3d38b8a686
backports: Add buster-backports to apt sources list
Fixes freedombox-team/freedom-maker#149

Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-02-05 14:58:27 -08:00
Sunil Mohan Adapa
655c2be214
backups: Improve performance of backup download
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-02-03 17:00:34 -05:00
Sunil Mohan Adapa
01492895c4
backups: Fix incomplete download archives
- Downloaded archives can't be fully extracted as tar.gz is incomplete at the
  end and corrupt. This is due to complete gzip streaming implementation that is
  does not flush the final bytes of gzip stream. Remove custom implementation
  and get gzipped stream directly from borg.

- Fix mimetype for .tar.gz to application/gzip.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-02-03 17:00:32 -05:00
Sunil Mohan Adapa
eb2b3bd86e
backups: Minor refactoring
- Mark some methods private.

- Fix some flake8 warnings.

- Remove unused exception.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-02-03 17:00:29 -05:00
Sunil Mohan Adapa
de22c79665
backups: Minor styling fixes
- Run yapf

- Fix flake8 errors/warnings.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-02-03 17:00:24 -05:00
Sunil Mohan Adapa
c22bec1cf4
backups: Remove dead code
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-02-03 17:00:21 -05:00
Sunil Mohan Adapa
34e0394713
backups: Minor styling fixes
- Run yapf

- Address some flake8 errors/warnings.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-02-03 17:00:19 -05:00
Sunil Mohan Adapa
623bbc87e8
backups: Remove incorrectly set buffer size during download
- Don't set bufsize to 1 while streaming backup download. This is only effective
  with text streams with universal_newline flag set. An actual buffer size of 1
  is very inefficient and plain wrong. Leave the python default of
  io.DEFAULT_BUFFER_SIZE.

- Minor simplification to argument passing.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-02-03 17:00:15 -05:00
James Valleroy
3941ec10fe
radicale: Handle migration from 1.x to 2.x
When radicale 2.x is available in testing, the migration can be
triggered by bumping the module's version.

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-02-01 14:53:19 -08:00
Prachi Srivastava
62b4f67a2e
help: Use freedombox package instead of plinth for version
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-01-30 23:10:08 -08:00
J. Carlos Romero
7f04088ddd
mldonkey: show 'Learn more...' link in package page when installed
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-01-29 10:22:25 -08:00
Sunil Mohan Adapa
72c1c7349f
js: Remove javascript license link from footer
The link is hidden but not removed. librejs will still parse it. Ideally we
would want to do this from <link data-jslicense='1' href=''> but that seems to
cause problems for librejs.

Librejs users can still find out about the license of Javscript script file
using Librejs menu.

We already have a link to FreedomBox source code in the home page.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2019-01-29 22:19:34 +05:30
Prachi Srivastava
743d976d50
security: Moves input field focus javascript to django forms
Signed-off-by: Prachi Srivastava <prachi.chs.2009@gmail.com>
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-01-28 17:39:22 -08:00
Prachi Srivastava
f43e185a8c
security: Moves inline javascript to files
Signed-off-by: Prachi Srivastava <prachi.chs.2009@gmail.com>
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-01-28 17:39:12 -08:00
Prachi Srivastava
19e244f152
networks: remove unused html
Signed-off-by: Prachi Srivastava <prachi.chs.2009@gmail.com>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-01-28 17:38:16 -08:00
Sunil Mohan Adapa
dc9ab52edc
axes: Minor fixes to configuration for IP blocking
- Use the X-Forwarded-For header only if specified in the configuration. This
  makes FreedomBox safe to use when not behind a reverse proxy server (although
  we are unlikely to do this).

- When fetching the IP address to reset after successful login, use the
  X-Forwarded-For header only if specified in the configuration.

- Minor flake8 refactorings.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-01-28 17:17:32 -05:00
J. Carlos Romero
1c8c9d067a
mldonkey: Add backup/restore support
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-01-28 10:54:27 -08:00
James Valleroy
5a8873508d
help: Add action script to read logs from journal
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-01-28 09:56:59 -08:00
James Valleroy
27cfd4786a
help: Use journalctl to show status log
The status log file had been removed previously.

Closes #1461

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-01-28 09:56:51 -08:00
Sunil Mohan Adapa
41d9419ddd
storage, backups: Minor styling and yapf fixes
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-01-27 11:10:42 -05:00
Sunil Mohan Adapa
9e316baa99
storage: Fix false error message visiting home page
When visiting homepage as a non-admin user, don't throw an error into the
console about not being able to get root partition information. This is a
regression from refactoring during backups change.

Fixes: #1468.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-01-27 11:10:36 -05:00
Sunil Mohan Adapa
c35cecb34a
openvpn: Add backup/restore support
- Add functional tests

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-01-27 08:16:24 -05:00
James Valleroy
24f1967b6a
radicale: Use rights file by default for radicale 2.x
The default rights file shipped in radicale 2.x package is equivalent
to owner_only. By setting this as our default, we can avoid any change
to the default config.

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-01-26 22:06:49 -08:00