This is only a build dependency for perl-Config-AutoConf and will not be installed on a system
Signed-off-by: Stefan Schantl stefan.schantl@ipfire.org --- config/rootfiles/common/perl-Capture-Tiny | 6 ++ lfs/perl-Capture-Tiny | 77 +++++++++++++++++++++++ make.sh | 1 + 3 files changed, 84 insertions(+) create mode 100644 config/rootfiles/common/perl-Capture-Tiny create mode 100644 lfs/perl-Capture-Tiny
diff --git a/config/rootfiles/common/perl-Capture-Tiny b/config/rootfiles/common/perl-Capture-Tiny new file mode 100644 index 000000000..4fb874d29 --- /dev/null +++ b/config/rootfiles/common/perl-Capture-Tiny @@ -0,0 +1,6 @@ +#usr/lib/perl5/site_perl/5.36.0/Capture +#usr/lib/perl5/site_perl/5.36.0/Capture/Tiny.pm +#usr/lib/perl5/site_perl/5.36.0/xxxMACHINExxx-linux-thread-multi/auto/Capture +#usr/lib/perl5/site_perl/5.36.0/xxxMACHINExxx-linux-thread-multi/auto/Capture/Tiny +#usr/lib/perl5/site_perl/5.36.0/xxxMACHINExxx-linux-thread-multi/auto/Capture/Tiny/.packlist +#usr/share/man/man3/Capture::Tiny.3 diff --git a/lfs/perl-Capture-Tiny b/lfs/perl-Capture-Tiny new file mode 100644 index 000000000..bb6b45e82 --- /dev/null +++ b/lfs/perl-Capture-Tiny @@ -0,0 +1,77 @@ +############################################################################### +# # +# IPFire.org - A linux based firewall # +# Copyright (C) 2007-2018 IPFire Team info@ipfire.org # +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU 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 General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program. If not, see http://www.gnu.org/licenses/. # +# # +############################################################################### + +############################################################################### +# Definitions +############################################################################### + +include Config + +VER = 0.48 + +THISAPP = Capture-Tiny-$(VER) +DL_FILE = $(THISAPP).tar.gz +DL_FROM = $(URL_IPFIRE) +DIR_APP = $(DIR_SRC)/$(THISAPP) +TARGET = $(DIR_INFO)/$(THISAPP) + +############################################################################### +# Top-level Rules +############################################################################### + +objects = $(DL_FILE) + +$(DL_FILE) = $(DL_FROM)/$(DL_FILE) + +$(DL_FILE)_BLAKE2 = e6de05459478131c5129dd5ffc84744e2d3440c2e31545ed101c2986b2bc970106f126286dea50350f4b5ea330ffac423693d755e29850883bdc215437bf7488 + +install : $(TARGET) + +check : $(patsubst %,$(DIR_CHK)/%,$(objects)) + +download :$(patsubst %,$(DIR_DL)/%,$(objects)) + +b2 : $(subst %,%_BLAKE2,$(objects)) + +############################################################################### +# Downloading, checking, b2sum +############################################################################### + +$(patsubst %,$(DIR_CHK)/%,$(objects)) : + @$(CHECK) + +$(patsubst %,$(DIR_DL)/%,$(objects)) : + @$(LOAD) + +$(subst %,%_BLAKE2,$(objects)) : + @$(B2SUM) + +############################################################################### +# Installation Details +############################################################################### + +$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) + @$(PREBUILD) + @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE) + cd $(DIR_APP) && perl Makefile.PL + cd $(DIR_APP) && make $(MAKETUNING) $(EXTRA_MAKE) + cd $(DIR_APP) && make install + @rm -rf $(DIR_APP) + @$(POSTBUILD) diff --git a/make.sh b/make.sh index e025f260f..ea0185e15 100755 --- a/make.sh +++ b/make.sh @@ -1377,6 +1377,7 @@ buildipfire() { lfsmake2 perl-Crypt-PasswdMD5 lfsmake2 perl-Net-Telnet lfsmake2 perl-JSON + lfsmake2 perl-Capture-Tiny lfsmake2 python3-inotify lfsmake2 python3-docutils lfsmake2 python3-daemon
This is only a build dependency for perl-Arhive-Peek-Libarchive and will not be installed on a system
Signed-off-by: Stefan Schantl stefan.schantl@ipfire.org --- config/rootfiles/common/perl-Config-AutoConf | 6 ++ lfs/perl-Config-AutoConf | 77 ++++++++++++++++++++ make.sh | 1 + 3 files changed, 84 insertions(+) create mode 100644 config/rootfiles/common/perl-Config-AutoConf create mode 100644 lfs/perl-Config-AutoConf
diff --git a/config/rootfiles/common/perl-Config-AutoConf b/config/rootfiles/common/perl-Config-AutoConf new file mode 100644 index 000000000..e46d506cc --- /dev/null +++ b/config/rootfiles/common/perl-Config-AutoConf @@ -0,0 +1,6 @@ +#usr/lib/perl5/site_perl/5.36.0/Config +#usr/lib/perl5/site_perl/5.36.0/Config/AutoConf.pm +#usr/lib/perl5/site_perl/5.36.0/xxxMACHINExxx-linux-thread-multi/auto/Config +#usr/lib/perl5/site_perl/5.36.0/xxxMACHINExxx-linux-thread-multi/auto/Config/AutoConf +#usr/lib/perl5/site_perl/5.36.0/xxxMACHINExxx-linux-thread-multi/auto/Config/AutoConf/.packlist +#usr/share/man/man3/Config::AutoConf.3 diff --git a/lfs/perl-Config-AutoConf b/lfs/perl-Config-AutoConf new file mode 100644 index 000000000..ce12c295b --- /dev/null +++ b/lfs/perl-Config-AutoConf @@ -0,0 +1,77 @@ +############################################################################### +# # +# IPFire.org - A linux based firewall # +# Copyright (C) 2007-2018 IPFire Team info@ipfire.org # +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU 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 General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program. If not, see http://www.gnu.org/licenses/. # +# # +############################################################################### + +############################################################################### +# Definitions +############################################################################### + +include Config + +VER = 0.320 + +THISAPP = Config-AutoConf-$(VER) +DL_FILE = $(THISAPP).tar.gz +DL_FROM = $(URL_IPFIRE) +DIR_APP = $(DIR_SRC)/$(THISAPP) +TARGET = $(DIR_INFO)/$(THISAPP) + +############################################################################### +# Top-level Rules +############################################################################### + +objects = $(DL_FILE) + +$(DL_FILE) = $(DL_FROM)/$(DL_FILE) + +$(DL_FILE)_BLAKE2 = 649ef56196a5984437f299f96b156f63560a247a35f0547145e3519648ba5fc86c057957570b45b696c2092a56deaf0595d9191b4fe389e0a0f183b79d6c500a + +install : $(TARGET) + +check : $(patsubst %,$(DIR_CHK)/%,$(objects)) + +download :$(patsubst %,$(DIR_DL)/%,$(objects)) + +b2 : $(subst %,%_BLAKE2,$(objects)) + +############################################################################### +# Downloading, checking, b2sum +############################################################################### + +$(patsubst %,$(DIR_CHK)/%,$(objects)) : + @$(CHECK) + +$(patsubst %,$(DIR_DL)/%,$(objects)) : + @$(LOAD) + +$(subst %,%_BLAKE2,$(objects)) : + @$(B2SUM) + +############################################################################### +# Installation Details +############################################################################### + +$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) + @$(PREBUILD) + @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE) + cd $(DIR_APP) && perl Makefile.PL + cd $(DIR_APP) && make $(MAKETUNING) $(EXTRA_MAKE) + cd $(DIR_APP) && make install + @rm -rf $(DIR_APP) + @$(POSTBUILD) diff --git a/make.sh b/make.sh index ea0185e15..1e31e203d 100755 --- a/make.sh +++ b/make.sh @@ -1378,6 +1378,7 @@ buildipfire() { lfsmake2 perl-Net-Telnet lfsmake2 perl-JSON lfsmake2 perl-Capture-Tiny + lfsmake2 perl-Config-AutoConf lfsmake2 python3-inotify lfsmake2 python3-docutils lfsmake2 python3-daemon
This is a runtime dependency of perl-Archive-Peek-Libarchive
Signed-off-by: Stefan Schantl stefan.schantl@ipfire.org --- config/rootfiles/common/perl-Object-Tiny | 6 ++ lfs/perl-Object-Tiny | 77 ++++++++++++++++++++++++ make.sh | 1 + 3 files changed, 84 insertions(+) create mode 100644 config/rootfiles/common/perl-Object-Tiny create mode 100644 lfs/perl-Object-Tiny
diff --git a/config/rootfiles/common/perl-Object-Tiny b/config/rootfiles/common/perl-Object-Tiny new file mode 100644 index 000000000..3ec9488d8 --- /dev/null +++ b/config/rootfiles/common/perl-Object-Tiny @@ -0,0 +1,6 @@ +#usr/lib/perl5/site_perl/5.36.0/Object +usr/lib/perl5/site_perl/5.36.0/Object/Tiny.pm +#usr/lib/perl5/site_perl/5.36.0/xxxMACHINExxx-linux-thread-multi/auto/Object +#usr/lib/perl5/site_perl/5.36.0/xxxMACHINExxx-linux-thread-multi/auto/Object/Tiny +#usr/lib/perl5/site_perl/5.36.0/xxxMACHINExxx-linux-thread-multi/auto/Object/Tiny/.packlist +#usr/share/man/man3/Object::Tiny.3 diff --git a/lfs/perl-Object-Tiny b/lfs/perl-Object-Tiny new file mode 100644 index 000000000..db19a6a25 --- /dev/null +++ b/lfs/perl-Object-Tiny @@ -0,0 +1,77 @@ +############################################################################### +# # +# IPFire.org - A linux based firewall # +# Copyright (C) 2007-2018 IPFire Team info@ipfire.org # +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU 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 General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program. If not, see http://www.gnu.org/licenses/. # +# # +############################################################################### + +############################################################################### +# Definitions +############################################################################### + +include Config + +VER = 1.09 + +THISAPP = Object-Tiny-$(VER) +DL_FILE = $(THISAPP).tar.gz +DL_FROM = $(URL_IPFIRE) +DIR_APP = $(DIR_SRC)/$(THISAPP) +TARGET = $(DIR_INFO)/$(THISAPP) + +############################################################################### +# Top-level Rules +############################################################################### + +objects = $(DL_FILE) + +$(DL_FILE) = $(DL_FROM)/$(DL_FILE) + +$(DL_FILE)_BLAKE2 = 0383d8af24d8c0d76dfc3cb6a65c6422f631d5ca4f9e083cf1077cc220b7aa27852c23ad5535bbcab74c7f5e9d1cba8f0f5c4d8da48c07a300d3b9e995b69d5c + +install : $(TARGET) + +check : $(patsubst %,$(DIR_CHK)/%,$(objects)) + +download :$(patsubst %,$(DIR_DL)/%,$(objects)) + +b2 : $(subst %,%_BLAKE2,$(objects)) + +############################################################################### +# Downloading, checking, b2sum +############################################################################### + +$(patsubst %,$(DIR_CHK)/%,$(objects)) : + @$(CHECK) + +$(patsubst %,$(DIR_DL)/%,$(objects)) : + @$(LOAD) + +$(subst %,%_BLAKE2,$(objects)) : + @$(B2SUM) + +############################################################################### +# Installation Details +############################################################################### + +$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) + @$(PREBUILD) + @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE) + cd $(DIR_APP) && perl Makefile.PL + cd $(DIR_APP) && make $(MAKETUNING) $(EXTRA_MAKE) + cd $(DIR_APP) && make install + @rm -rf $(DIR_APP) + @$(POSTBUILD) diff --git a/make.sh b/make.sh index 1e31e203d..380d481db 100755 --- a/make.sh +++ b/make.sh @@ -1379,6 +1379,7 @@ buildipfire() { lfsmake2 perl-JSON lfsmake2 perl-Capture-Tiny lfsmake2 perl-Config-AutoConf + lfsmake2 perl-Object-Tiny lfsmake2 python3-inotify lfsmake2 python3-docutils lfsmake2 python3-daemon
As very simple XS based perl binding for libarchive to get header data and extract files.
Signed-off-by: Stefan Schantl stefan.schantl@ipfire.org --- .../common/perl-Archive-Peek-Libarchive | 8 ++ lfs/perl-Archive-Peek-Libarchive | 77 +++++++++++++++++++ make.sh | 1 + 3 files changed, 86 insertions(+) create mode 100644 config/rootfiles/common/perl-Archive-Peek-Libarchive create mode 100644 lfs/perl-Archive-Peek-Libarchive
diff --git a/config/rootfiles/common/perl-Archive-Peek-Libarchive b/config/rootfiles/common/perl-Archive-Peek-Libarchive new file mode 100644 index 000000000..95e204562 --- /dev/null +++ b/config/rootfiles/common/perl-Archive-Peek-Libarchive @@ -0,0 +1,8 @@ +#usr/lib/perl5/site_perl/5.36.0/xxxMACHINExxx-linux-thread-multi/Archive +#usr/lib/perl5/site_perl/5.36.0/xxxMACHINExxx-linux-thread-multi/Archive/Peek +usr/lib/perl5/site_perl/5.36.0/xxxMACHINExxx-linux-thread-multi/Archive/Peek/Libarchive.pm +#usr/lib/perl5/site_perl/5.36.0/xxxMACHINExxx-linux-thread-multi/auto/Archive/Peek +#usr/lib/perl5/site_perl/5.36.0/xxxMACHINExxx-linux-thread-multi/auto/Archive/Peek/Libarchive +#usr/lib/perl5/site_perl/5.36.0/xxxMACHINExxx-linux-thread-multi/auto/Archive/Peek/Libarchive/.packlist +usr/lib/perl5/site_perl/5.36.0/xxxMACHINExxx-linux-thread-multi/auto/Archive/Peek/Libarchive/Libarchive.so +#usr/share/man/man3/Archive::Peek::Libarchive.3 diff --git a/lfs/perl-Archive-Peek-Libarchive b/lfs/perl-Archive-Peek-Libarchive new file mode 100644 index 000000000..fd1ae85d6 --- /dev/null +++ b/lfs/perl-Archive-Peek-Libarchive @@ -0,0 +1,77 @@ +############################################################################### +# # +# IPFire.org - A linux based firewall # +# Copyright (C) 2007-2018 IPFire Team info@ipfire.org # +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU 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 General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program. If not, see http://www.gnu.org/licenses/. # +# # +############################################################################### + + +############################################################################### +# Definitions +############################################################################### + +include Config +VER = 0.38 + +THISAPP = Archive-Peek-Libarchive-$(VER) +DL_FILE = ${THISAPP}.tar.gz +DL_FROM = $(URL_IPFIRE) +DIR_APP = $(DIR_SRC)/$(THISAPP) +TARGET = $(DIR_INFO)/$(THISAPP) + +############################################################################### +# Top-level Rules +############################################################################### + +objects = $(DL_FILE) + +$(DL_FILE) = $(DL_FROM)/$(DL_FILE) + +$(DL_FILE)_BLAKE2 = 142d54a6fe6b948129307ef7b0106905b2ddf858682d07a4f0815e6674f7fd425f462a800487949e18442884d6c743aeed049ebef7138fe0bfbbabac588dc3b3 + +install : $(TARGET) + +check : $(patsubst %,$(DIR_CHK)/%,$(objects)) + +download :$(patsubst %,$(DIR_DL)/%,$(objects)) + +b2 : $(subst %,%_BLAKE2,$(objects)) + +############################################################################### +# Downloading, checking, b2sum +############################################################################### + +$(patsubst %,$(DIR_CHK)/%,$(objects)) : + @$(CHECK) + +$(patsubst %,$(DIR_DL)/%,$(objects)) : + @$(LOAD) + +$(subst %,%_BLAKE2,$(objects)) : + @$(B2SUM) + +############################################################################### +# Installation Details +############################################################################### + +$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) + @$(PREBUILD) + @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE) + cd $(DIR_APP) && perl Makefile.PL + cd $(DIR_APP) && make $(MAKETUNING) $(EXTRA_MAKE) + cd $(DIR_APP) && make install + @rm -rf $(DIR_APP) + @$(POSTBUILD) diff --git a/make.sh b/make.sh index 380d481db..f15e93acb 100755 --- a/make.sh +++ b/make.sh @@ -1380,6 +1380,7 @@ buildipfire() { lfsmake2 perl-Capture-Tiny lfsmake2 perl-Config-AutoConf lfsmake2 perl-Object-Tiny + lfsmake2 perl-Archive-Peek-Libarchive lfsmake2 python3-inotify lfsmake2 python3-docutils lfsmake2 python3-daemon
This gives us a lot of benefits:
* Speed up the extraction process * More supported archive types due the power of libarchive * Support of passphrase protected archives
It also fixes a problem with non extracted files next to a zero sized file inside an archive.
Fixes #13632.
Signed-off-by: Stefan Schantl stefan.schantl@ipfire.org --- config/cfgroot/ids-functions.pl | 56 +++++++++++---------------------- 1 file changed, 18 insertions(+), 38 deletions(-)
diff --git a/config/cfgroot/ids-functions.pl b/config/cfgroot/ids-functions.pl index c29a5151f..3eb883aa9 100644 --- a/config/cfgroot/ids-functions.pl +++ b/config/cfgroot/ids-functions.pl @@ -30,7 +30,7 @@ require "${General::swroot}/network-functions.pl"; require "${General::swroot}/suricata/ruleset-sources";
# Load perl module to deal with Archives. -use Archive::Tar; +use Archive::Peek::Libarchive;
# Load perl module to deal with files and path. use File::Basename; @@ -515,9 +515,6 @@ sub downloadruleset ($) { sub extractruleset ($) { my ($provider) = @_;
- # Disable chown functionality when uncompressing files. - $Archive::Tar::CHOWN = "0"; - # Get full path and downloaded rulesfile for the given provider. my $tarball = &_get_dl_rulesfile($provider);
@@ -547,13 +544,11 @@ sub extractruleset ($) {
} elsif ( $type eq "archive") { # Initialize the tar module. - my $tar = Archive::Tar->new($tarball); - - # Get the filelist inside the tarball. - my @packed_files = $tar->list_files; + my $tar = Archive::Peek::Libarchive->new(filename => $tarball);
- # Loop through the filelist. - foreach my $packed_file (@packed_files) { + # Loop through the archive + $tar->iterate( sub { + my ($packed_file, $content) = @_; my $destination;
# Splitt the packed file into chunks. @@ -572,13 +567,13 @@ sub extractruleset ($) { # Handle rules files. } elsif ($file =~ m/.rules$/) { # Skip rule files which are not located in the rules directory or archive root. - next unless(($packed_file =~ /^rules//) || ($packed_file =~ /^$provider-rules//) || ($packed_file !~ ///)); + return unless(($packed_file =~ /^rules//) || ($packed_file =~ /^$provider-rules//) || ($packed_file !~ ///));
# Skip deleted.rules. # # Mostly they have been taken out for correctness or performance reasons and therfore # it is not a great idea to enable any of them. - next if($file =~ m/deleted.rules$/); + return if($file =~ m/deleted.rules$/);
my $rulesfilename;
@@ -615,39 +610,24 @@ sub extractruleset ($) { $destination = "$tmp_rules_directory/$rulesfilename"; } else { # Skip all other files. - next; + return; }
# Check if the destination file exists. unless(-e "$destination") { - # Extract the file to the temporary directory. - $tar->extract_file("$packed_file", "$destination"); + # Open filehandle to write the content to a new file. + open(FILE, ">", "$destination") or die "Could not open $destination. $!\n"; } else { - # Generate temporary file name, located in the temporary rules directory and a suffix of ".tmp". - my $tmp = File::Temp->new( SUFFIX => ".tmp", DIR => "$tmp_rules_directory", UNLINK => 0 ); - my $tmpfile = $tmp->filename(); - - # Extract the file to the new temporary file name. - $tar->extract_file("$packed_file", "$tmpfile"); - - # Open the the existing file. - open(DESTFILE, ">>", "$destination") or die "Could not open $destination. $!\n"; - open(TMPFILE, "<", "$tmpfile") or die "Could not open $tmpfile. $!\n"; - - # Loop through the content of the temporary file. - while (<TMPFILE>) { - # Append the content line by line to the destination file. - print DESTFILE "$_"; - } + # Open filehandle to append the content to the existing file. + open(FILE, ">>", "$destination") or die "Could not open $destination. $!\n"; + }
- # Close the file handles. - close(TMPFILE); - close(DESTFILE); + # Write the extracted file content to the filehandle. + print FILE "$content" if ($content);
- # Remove the temporary file. - unlink("$tmpfile"); - } - } + # Close the file handle. + close(FILE); + }); } }