Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
a156c466
Commit
a156c466
authored
Mar 19, 2015
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reformat tag line of encrypted backup
parent
a453bfe8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
15 deletions
+15
-15
config.lib.inc
src/etc/inc/config.lib.inc
+2
-1
diag_backup.php
src/www/diag_backup.php
+13
-14
No files found.
src/etc/inc/config.lib.inc
View file @
a156c466
...
...
@@ -447,7 +447,8 @@ function backup_to_google_drive() {
$client
->
login
(
$config
->
system
->
remotebackup
->
GDriveEmail
->
__toString
(),
$config
->
system
->
remotebackup
->
GDriveP12key
->
__toString
()
);
// backup source data to local strings (plain/encrypted)
$confdata
=
file_get_contents
(
'/conf/config.xml'
)
;
$confdata_enc
=
encrypt_data
(
$confdata
,
$config
->
system
->
remotebackup
->
GDrivePassword
->
__toString
())
;
$confdata_enc
=
encrypt_data
(
$confdata
,
$config
->
system
->
remotebackup
->
GDrivePassword
->
__toString
())
;
tagfile_reformat
(
$confdata_enc
,
$confdata_enc
,
"config.xml"
);
// read filelist (config-*.xml) and cleanup old files
...
...
src/www/diag_backup.php
View file @
a156c466
...
...
@@ -291,7 +291,6 @@ if ($_POST) {
if
(
$_POST
[
'decrypt'
])
{
if
(
!
tagfile_deformat
(
$data
,
$data
,
"config.xml"
))
{
$input_errors
[]
=
gettext
(
"The uploaded file does not appear to contain an encrypted OPNsense configuration."
);
return
1
;
}
$data
=
decrypt_data
(
$data
,
$_POST
[
'decrypt_password'
]);
}
...
...
@@ -321,7 +320,7 @@ if ($_POST) {
}
}
}
else
{
if
(
true
)
{
if
(
!
$input_errors
)
{
/* restore the entire configuration */
$filename
=
$_FILES
[
'conffile'
][
'tmp_name'
];
file_put_contents
(
$filename
,
$data
);
...
...
@@ -505,20 +504,20 @@ if ($_POST) {
unset
(
$config
[
'system'
][
'remotebackup'
][
'GDriveP12key'
]);
}
write_config
();
// test / perform backup
try
{
$filesInBackup
=
backup_to_google_drive
()
;
}
catch
(
Exception
$e
)
{
$filesInBackup
=
array
()
;
}
write_config
();
// test / perform backup
try
{
$filesInBackup
=
backup_to_google_drive
()
;
}
catch
(
Exception
$e
)
{
$filesInBackup
=
array
()
;
}
if
(
count
(
$filesInBackup
)
==
0
)
{
$input_errors
[]
=
gettext
(
"Google Drive communication failure"
);
}
else
{
$input_messages
=
gettext
(
"Backup succesfull, current filelist:"
);
if
(
count
(
$filesInBackup
)
==
0
)
{
$input_errors
[]
=
gettext
(
"Google Drive communication failure"
);
}
else
{
$input_messages
=
gettext
(
"Backup succesfull, current filelist:"
);
foreach
(
$filesInBackup
as
$filename
=>
$file
)
{
$input_messages
=
$input_messages
.
"<br>"
.
$filename
;
$input_messages
=
$input_messages
.
"<br>"
.
$filename
;
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment