mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
SSO: Generate keys during plinth startup
- Removed key generation for mod_auth_pubtkt from first boot. - Running setup every time plinth starts so that new essential modules can be setup properly. Partially fixes #875
This commit is contained in:
1 parent
db269fc892
commit
5403d00e85
5 files changed
+13
-30
No files matched your search
@@ -18,7 +18,7 @@
|
||||
Plinth module to configure Single Sign On services.
|
||||
"""
|
||||
|
||||
from plinth import actions, action_utils
|
||||
from plinth import actions
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
version = 1
|
||||
@@ -31,15 +31,8 @@ title = _('Single Sign On')
|
||||
|
||||
managed_packages = ['libapache2-mod-auth-pubtkt', 'openssl', 'python3-openssl']
|
||||
|
||||
first_boot_steps = [
|
||||
{
|
||||
'id': 'sso_firstboot',
|
||||
'url': 'sso:firstboot',
|
||||
'order': 1
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
def setup(helper, old_version=None):
|
||||
"""Install the required packages"""
|
||||
helper.install(managed_packages)
|
||||
actions.superuser_run('auth-pubtkt', ['create-key-pair'])
|
||||
@@ -20,11 +20,10 @@ URLs for the Single Sign On module.
|
||||
|
||||
from django.conf.urls import url
|
||||
|
||||
from .views import login, refresh, FirstBootView
|
||||
from .views import login, refresh
|
||||
from stronghold.decorators import public
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^accounts/sso/login/$', public(login), name='sso-login'),
|
||||
url(r'^accounts/sso/refresh/$', refresh, name='sso-refresh'),
|
||||
url(r'^accounts/sso/firstboot/$', public(FirstBootView.as_view()), name='firstboot'),
|
||||
]
|
||||
@@ -22,11 +22,8 @@ import os
|
||||
import urllib
|
||||
|
||||
from plinth import actions
|
||||
from plinth.modules import first_boot
|
||||
|
||||
from django.urls import reverse
|
||||
from django.http import HttpResponseRedirect
|
||||
from django.views.generic.base import RedirectView
|
||||
from django.contrib.auth import REDIRECT_FIELD_NAME
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.contrib.auth.views import (login as auth_login, logout as
|
||||
@@ -75,12 +72,3 @@ def refresh(request):
|
||||
response = HttpResponseRedirect(redirect_url)
|
||||
response.delete_cookie(SSO_COOKIE_NAME)
|
||||
return set_ticket_cookie(request.user, response)
|
||||
|
||||
|
||||
class FirstBootView(RedirectView):
|
||||
"""Create keys for Apache server during first boot"""
|
||||
|
||||
def get_redirect_url(self, *args, **kwargs):
|
||||
actions.superuser_run('auth-pubtkt', ['create-key-pair'])
|
||||
first_boot.mark_step_done('sso_firstboot')
|
||||
return reverse(first_boot.next_step())
|
||||
@@ -38,7 +38,7 @@ first_boot_steps = [
|
||||
{
|
||||
'id': 'users_firstboot',
|
||||
'url': 'users:firstboot',
|
||||
'order': 2
|
||||
'order': 1
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
Reference in new issue
Block a user