36 Commits

Author SHA1 Message Date
Sunil Mohan Adapa
3c7bc4a192
*: pylint: Explicitly specify encoding when open a file
This is recommended by PEP-0597: https://peps.python.org/pep-0597/

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-07-04 19:45:57 -04:00
Sunil Mohan Adapa
74214c18ae
*: Use Django gettext functions instead of ugettext
- ugettext functions will be removed in Django 4.0. Each use emits a warning
when running with Django 3.2. Since we have warnings enabled in developer mode,
we see quite a few messages because of this.

- ugettext is already a simple alias of gettext. So, no regressions are
expected.

Tests:

- Accessing an affected app in UI with Django 3.2 and Django 2.2 works fine.

- Using Django 3.2 there are no warnings related to removal of ugettext
functions.

- Ran regular unit tests.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-09-20 16:50:16 -04:00
Sunil Mohan Adapa
9368504da5
*.py: Use SPDX license identifier
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2020-02-19 14:38:55 +02:00
Joseph Nuthalapati
815d3ec0e8
firstboot: reading firstboot-wizard-secret file
Explain how to read the firstboot-wizard-secret file using shell
commands. Remove output of the cat command.

Signed-off-by: Joseph Nuthalapati <njoseph@riseup.net>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-11-18 18:10:24 -05:00
Joseph Nuthalapati
ba9af6ddff
firstboot: Prompt for secret during firstboot welcome
- A freshly installed FreedomBox can be hijacked by a third party and an admin
  account can be created which can be used to inject malware or simply take over
  the instance. Password protecting the firstboot step is a good way to avoid
  this. A secret will be displayed to the user as soon as the Plinth package
  is installed, which they have to enter during firstboot welcome step. Also,
  writing this to a file in plinth's home in case the user loses it.
- This protection is not applicable for images built by freedom-maker and for
  Amazon Machine Images.

Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-07-04 20:22:54 -04:00
Sunil Mohan Adapa
c37aa0fbd5
firstboot: Indentation & styling fixes
pycodestyle version used is 2.1.0 with default arguments.
2016-12-04 15:24:31 -05:00
Hemanth Kumar Veeranki
6011a7adfa
Made Suggested Changes 2016-11-03 22:06:08 -04:00
Sunil Mohan Adapa
e719966c4b
users: Refactor valid user name checking for reuse
- Supress output from getent

- More accurate message
2016-08-12 19:32:19 +05:30
James Valleroy
c8c6bc377b
users: Add list of restricted usernammes
List is derived from optional services installed.
2016-08-12 18:48:16 +05:30
James Valleroy
3a69958165
users: Avoid username conflicts with system users
When creating or renaming a user, check if the new username is in use by
any system user.
2016-08-12 18:47:52 +05:30
Sunil Mohan Adapa
2afae80dd8
security: Recommend/notify about restricted logins
- Do stricter matches when editing configuration file.  Earlier
  mechanism would match comments etc.

- Move action methods to module core from views.

- During first boot, notify users that console login is restricted and
  that they can changed that from security settings.

- Recommend enabling conosle login restrictions.  Add message about why
  console restrictions are important.

- Show title in security module.
2016-07-09 22:42:20 +05:30
James Valleroy
82c27aabf3
first_boot: Enable restricted console logins 2016-07-09 22:41:53 +05:30
Sunil Mohan Adapa
c3c44ab379
firstboot: Minor Danube PageKite fixes
- Fix message internationalization with formatting and laziness.

- Styling fixes.

- Simplify Subdomain widget.

- Update messages for grammer and consistency.
2016-03-13 23:32:26 +05:30
fonfon
435f980c6f
firstboot: freedombox.me pagekite vouchers
- Show PageKite voucher only if cfg.danube_edition is enabled
2016-03-13 23:32:20 +05:30
Sunil Mohan Adapa
3df1a88824 Switch to Django i18n for code strings
Django i18n layer is on top of gettext and provide may crucial features
such as per-request locales, lazy translations etc.
2015-11-13 22:08:43 +05:30
Sunil Mohan Adapa
f3a0c70d23 first_boot: Add separate greeting page 2015-10-28 20:02:56 -04:00
Sunil Mohan Adapa
23eb40fce8 first_boot: Require password confirmation
- Use existing UserCreationForm from auth module.

- Use cleaned data for login.
2015-10-28 20:02:56 -04:00
Sunil Mohan Adapa
62185a5960 first_boot: Don't ask for a new hostname
- Setting a new hostname is not one of the most buring issues to be take
  care of during the setup process.

- Also, most likely the user will access the FreedomBox machine using
  mDNS hostname such as freedombox.local.  Changing the hostname mid
  setup might have consequences that need to thought about properly.
2015-10-28 20:02:56 -04:00
James Valleroy
7a464d6f5f first_boot: Switch to new ldap action. 2015-07-26 16:34:29 -04:00
James Valleroy
d144f6634a Bug fixes:
Check if ejabberd is installed when running actions triggered by signals.
Encode LDAP passwords as bytes.
2015-07-23 22:30:50 +05:30
James Valleroy
cb7c9c26f7 Send LDAP user passwords to actions through stdin, not as arguments. 2015-07-23 22:30:50 +05:30
James Valleroy
86580c9121 Revert "Don't print LDAP user passwords in log."
This reverts commit b1c9c81d58c80d6b313dd2b8a5c5727ecdf6ac49.

Conflicts:
	plinth/modules/first_boot/forms.py
2015-07-23 22:30:50 +05:30
Sunil Mohan Adapa
f35d4257c2 users: Improve Django group handling with LDAP
- Create groups on first boot a bit more safely

- Use get_or_create instead of get() and create()

- Fix issue with not showing a full list of groups in user modify page
  when there is are no users for that group.
2015-07-18 17:17:07 +05:30
James Valleroy
fcc37a8e28 Create initial django groups during first_boot. 2015-07-13 19:50:59 +05:30
James Valleroy
b1c9c81d58 Don't print LDAP user passwords in log. 2015-07-13 19:50:58 +05:30
James Valleroy
0eb3d35b5b Add group management to user editing form. 2015-07-13 19:50:58 +05:30
James Valleroy
197c95a7bf Add actions for LDAP group management. 2015-07-13 19:50:58 +05:30
James Valleroy
2adf14b8b7 Remove POSIX users. 2015-07-13 19:50:58 +05:30
James Valleroy
bc8523d9a3 first_boot: Also create LDAP user for initial user. 2015-06-12 15:49:41 +05:30
Sunil Mohan Adapa
a3de3ae277 users: Handle errors better during POSIX user operations
- If during an action, user does not exist ignore.

- If during an action, return a non-zero exist status.

- Catch an errors during actions as exceptions.

- Display a message that corresponding POSIX operation failed.
2015-01-25 01:45:51 +05:30
Sunil Mohan Adapa
d27cd02193 users: Add posix user messages to other user management forms
- Slightly modify the message in user update form
2015-01-25 01:45:43 +05:30
James Valleroy
1a081bfab0 Create POSIX user during firstboot. Closes #31. 2015-01-20 12:28:53 +05:30
Sunil Mohan Adapa
90203986f2 Remove modules 'expert_mode' and 'lib'.
The login/logout URLs are now in the 'users' module.
2014-12-14 17:26:05 +05:30
Sunil Mohan Adapa
5b969d9d30 Explicitly write license headers for each source file
The package license (AGPL3+) implicitly indicates the license of each
file.  However, it is desirable to have license headers in each file.
This is the case for many prominent projects like GNU project, Mozilla
etc.
2014-11-30 14:49:49 +05:30
Sunil Mohan Adapa
0bb2dd51d8 Minor styling changes in first boot module 2014-10-20 00:22:47 +05:30
fonfon
94040e402a refactored first boot module; user is now logged in automatically after an account is created 2014-10-20 00:15:49 +05:30