security: Enable backup/restore

Currently only the restricted login setting is backed up and restored. Fail2Ban
needs ability to backup and restore state of services.

Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Joseph Nuthalapati 2018-10-18 13:53:32 -07:00 committed by James Valleroy
parent b04ac3c76c
commit 327741bc22
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808
3 changed files with 37 additions and 0 deletions

View File

@ -31,3 +31,11 @@ Scenario: Disable restricted console logins
Given restricted console logins are enabled
When I disable restricted console logins
Then restricted console logins should be disabled
Scenario: Backup and restore security
When I enable restricted console logins
And I create a backup of the security app data
And I disable restricted console logins
And I export the security app data backup
And I restore the security app data backup
Then restricted console logins should be enabled

View File

@ -23,6 +23,8 @@ from django.utils.translation import ugettext_lazy as _
from plinth import actions
from plinth.menu import main_menu
from .manifest import backup
version = 4
is_essential = True

View File

@ -0,0 +1,27 @@
#
# This file is part of FreedomBox.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
"""
Application manifest for security.
"""
from plinth.modules.backups.api import validate as validate_backup
backup = validate_backup({
'config': {
'files': ['/etc/security/access.conf']
}
})