mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
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>
This commit is contained in:
1 parent
d846987e8c
commit
ba9af6ddff
9 files changed
+113
-25
No files matched your search
@@ -19,21 +19,31 @@ from django import http
|
||||
from django.urls import reverse
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.views.generic import TemplateView
|
||||
from django.views.generic.edit import FormView
|
||||
|
||||
from plinth import network
|
||||
from plinth.modules import first_boot
|
||||
|
||||
from .forms import FirstbootWizardSecretForm
|
||||
|
||||
class WelcomeView(TemplateView):
|
||||
|
||||
class WelcomeView(FormView):
|
||||
"""Show the welcome screen."""
|
||||
|
||||
form_class = FirstbootWizardSecretForm
|
||||
template_name = 'firstboot_welcome.html'
|
||||
|
||||
def post(self, request, *args, **kwargs):
|
||||
"""On POST, mark this step as done and move to next step."""
|
||||
def form_valid(self, form):
|
||||
"""If form is valid, mark this step as done and move to next step."""
|
||||
first_boot.mark_step_done('firstboot_welcome')
|
||||
return http.HttpResponseRedirect(reverse(first_boot.next_step()))
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
"""Add network connections to context list."""
|
||||
context = super().get_context_data(**kwargs)
|
||||
show_prompt = first_boot.firstboot_wizard_secret_exists()
|
||||
context['show_wizard_password_prompt'] = show_prompt
|
||||
return context
|
||||
|
||||
|
||||
class CompleteView(TemplateView):
|
||||
"""Show summary after all firstboot setup is done.
|
||||
|
||||
Reference in new issue
Block a user