From 28dce5169636666d0ed7ddac9bc8e9de6589f006 Mon Sep 17 00:00:00 2001 From: Will Budic Date: Tue, 25 Feb 2020 17:03:32 +1100 Subject: [PATCH] continued some backup dev. --- htdocs/cgi-bin/config.cgi | 64 ++++++++++++++++++++++++++++----------- 1 file changed, 47 insertions(+), 17 deletions(-) diff --git a/htdocs/cgi-bin/config.cgi b/htdocs/cgi-bin/config.cgi index 2139ba3..527b3a8 100755 --- a/htdocs/cgi-bin/config.cgi +++ b/htdocs/cgi-bin/config.cgi @@ -21,8 +21,6 @@ use Date::Language; use Text::CSV; use Scalar::Util qw(looks_like_number); use Sys::Syslog qw(:DEFAULT :standard :macros); -use IO::Zlib; -use Archive::Tar; #DEFAULT SETTINGS HERE! use lib "system/modules"; @@ -117,7 +115,7 @@ my $tbl = ' @@ -365,13 +363,20 @@ print qq(
'.$row[0].'
- + + + + + + + +

Backup File Format


Restore will bring back and merge log entries from the time of backup.



CSV File Format

Import Categories:
Export Categories: @@ -921,23 +926,48 @@ sub updCnf { } } + sub backup { - my $ball = $today->strftime('%Y%m%d%H%M%S_')."$dbname.tgz"; - my $tar = Archive::Tar->new(); - my @fls =(&Settings::logPath.'main.cnf',$database); - $tar-> add_files(@fls); - $tar->write(Settings::logPath().$ball,9); + # my $ball2 = qwq(tar -czf - data_*_log.db | openssl enc -e -des-ede3-cfb -out secured.tgz); + #openssl enc -d -des-ede3-cfb -in secured.tar.gz | tar xz -C test + + my $ball = $today->strftime('%Y%m%d%H%M%S_')."$dbname.osz"; + my $pipe = "tar czf - ".&Settings::logPath.'main.cnf' ."$database | openssl enc -k $pass:$userid -e -des-ede3-cfb -out ".Settings::logPath().$ball; + `$pipe`; + + # my $ball = $today->strftime('%Y%m%d%H%M%S_')."$dbname.tgz"; + # my $pipe = new IO::File("| openssl enc -k $pass:$userid -e -des-ede3-cfb | gzip -c >".Settings::logPath().$ball); + # my @fls =(&Settings::logPath.'main.cnf',$database); + # my $tar = Archive::Tar->new(); + # $tar-> add_files(@fls); + # $tar->write($pipe); + # $pipe->close; + + # my @tar = qw("tar -czf "); + # push @tar, &Settings::logPath. "data_*_log.db"; + # push @tar, qw(|openssl enc -e -pbkdf2 -out); + # push @tar, $ball; + # my $res = run @tar; + + + + + # my $tar = Archive::Tar->new(); + # my @fls =(&Settings::logPath.'main.cnf',$database); + # $tar-> add_files(@fls); + # $tar->write(Settings::logPath().$ball,9); + # Not allowed following for now # - # print $cgi->header(-type=>"application/octet-stream", -attachment=>"$ball"); - # select(STDOUT); $| = 1; #unbuffer STDOUT - # binmode STDOUT; - # open (TAR, '<', Settings::logPath().$ball); - # print ; - # close TAR; - - LifeLogException->throw("Backup feature currently under development! Serverside created files is -> $ball"); + print $cgi->header(-type=>"application/octet-stream", -attachment=>"$ball"); + select(STDOUT); $| = 1; #unbuffer STDOUT + binmode STDOUT; + open (TAR, '<', Settings::logPath().$ball); + print ; + close TAR; + + # LifeLogException->throw("Backup feature currently under development! Serverside created files is -> $ball"); } -- 2.34.1