mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-20 10:34:30 +00:00
security: Move backports notice to security page
Move get_backports_in_use to upgrades. Signed-off-by: James Valleroy <jvalleroy@mailbox.org> Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
parent
d042c3c60c
commit
f41cc116a1
@ -74,17 +74,4 @@
|
|||||||
{% endblocktrans %}
|
{% endblocktrans %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
{% if backports_in_use %}
|
|
||||||
<h3>{% trans "Security Notice" %}</h3>
|
|
||||||
<p>
|
|
||||||
{% blocktrans trimmed %}
|
|
||||||
You are using packages from Debian backports. Please note that these
|
|
||||||
packages do not have security support from Debian. However, they are
|
|
||||||
maintained on a best-effort basis by contributors in Debian and
|
|
||||||
FreedomBox community.
|
|
||||||
{% endblocktrans %}
|
|
||||||
</p>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@ -6,7 +6,6 @@ Help app for FreedomBox.
|
|||||||
import mimetypes
|
import mimetypes
|
||||||
import os
|
import os
|
||||||
import pathlib
|
import pathlib
|
||||||
import subprocess
|
|
||||||
|
|
||||||
from apt.cache import Cache
|
from apt.cache import Cache
|
||||||
from django.core.files.base import File
|
from django.core.files.base import File
|
||||||
@ -52,7 +51,6 @@ def about(request):
|
|||||||
'version': __version__,
|
'version': __version__,
|
||||||
'new_version': not freedombox.candidate.is_installed,
|
'new_version': not freedombox.candidate.is_installed,
|
||||||
'os_release': get_os_release(),
|
'os_release': get_os_release(),
|
||||||
'backports_in_use': get_backports_in_use(),
|
|
||||||
}
|
}
|
||||||
return TemplateResponse(request, 'help_about.html', context)
|
return TemplateResponse(request, 'help_about.html', context)
|
||||||
|
|
||||||
@ -134,16 +132,3 @@ def get_os_release():
|
|||||||
line = line.split('=')
|
line = line.split('=')
|
||||||
output = line[1]
|
output = line[1]
|
||||||
return output
|
return output
|
||||||
|
|
||||||
|
|
||||||
def get_backports_in_use():
|
|
||||||
"""Return whether backports packages are installed."""
|
|
||||||
# Only freedombox package is set to be installed from backports currently.
|
|
||||||
output = subprocess.check_output(['apt-cache', 'policy', 'freedombox'])
|
|
||||||
for line in output.decode().split('\n'):
|
|
||||||
if 'Installed:' in line:
|
|
||||||
version = line.strip().split(': ')[1]
|
|
||||||
if 'bpo' in version:
|
|
||||||
return True
|
|
||||||
|
|
||||||
return False
|
|
||||||
|
|||||||
@ -7,6 +7,18 @@
|
|||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
|
||||||
{% block status %}
|
{% block status %}
|
||||||
|
{% if backports_in_use %}
|
||||||
|
<h3>{% trans "Security Notice" %}</h3>
|
||||||
|
<p>
|
||||||
|
{% blocktrans trimmed %}
|
||||||
|
You are using packages from Debian backports. Please note that these
|
||||||
|
packages do not have security support from Debian. However, they are
|
||||||
|
maintained on a best-effort basis by contributors in Debian and
|
||||||
|
FreedomBox community.
|
||||||
|
{% endblocktrans %}
|
||||||
|
</p>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<a class="btn btn-default" role="button" href="{% url 'security:report' %}"
|
<a class="btn btn-default" role="button" href="{% url 'security:report' %}"
|
||||||
title="{% trans 'Show security report' %}">
|
title="{% trans 'Show security report' %}">
|
||||||
<span class="fa fa-line-chart" aria-hidden="true"></span>
|
<span class="fa fa-line-chart" aria-hidden="true"></span>
|
||||||
|
|||||||
@ -9,6 +9,7 @@ from django.utils.translation import ugettext as _
|
|||||||
|
|
||||||
from plinth import action_utils, actions
|
from plinth import action_utils, actions
|
||||||
from plinth.modules import security
|
from plinth.modules import security
|
||||||
|
from plinth.modules.upgrades import get_backports_in_use
|
||||||
|
|
||||||
from .forms import SecurityForm
|
from .forms import SecurityForm
|
||||||
|
|
||||||
@ -28,10 +29,12 @@ def index(request):
|
|||||||
else:
|
else:
|
||||||
form = SecurityForm(initial=status, prefix='security')
|
form = SecurityForm(initial=status, prefix='security')
|
||||||
|
|
||||||
return TemplateResponse(request, 'security.html', {
|
return TemplateResponse(
|
||||||
'app_info': security.app.info,
|
request, 'security.html', {
|
||||||
'form': form,
|
'app_info': security.app.info,
|
||||||
})
|
'form': form,
|
||||||
|
'backports_in_use': get_backports_in_use(),
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
def get_status(request):
|
def get_status(request):
|
||||||
|
|||||||
@ -3,6 +3,8 @@
|
|||||||
FreedomBox app for upgrades.
|
FreedomBox app for upgrades.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import subprocess
|
||||||
|
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from django.utils.translation import ugettext_noop
|
from django.utils.translation import ugettext_noop
|
||||||
|
|
||||||
@ -131,3 +133,16 @@ def disable():
|
|||||||
def _setup_repositories(data):
|
def _setup_repositories(data):
|
||||||
"""Setup apt backport repositories."""
|
"""Setup apt backport repositories."""
|
||||||
actions.superuser_run('upgrades', ['setup-repositories'])
|
actions.superuser_run('upgrades', ['setup-repositories'])
|
||||||
|
|
||||||
|
|
||||||
|
def get_backports_in_use():
|
||||||
|
"""Return whether backports packages are installed."""
|
||||||
|
# Only freedombox package is set to be installed from backports currently.
|
||||||
|
output = subprocess.check_output(['apt-cache', 'policy', 'freedombox'])
|
||||||
|
for line in output.decode().split('\n'):
|
||||||
|
if 'Installed:' in line:
|
||||||
|
version = line.strip().split(': ')[1]
|
||||||
|
if 'bpo' in version:
|
||||||
|
return True
|
||||||
|
|
||||||
|
return False
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user