ip6tables settings to block the ipv6 fragmentation - linux

Is it possible to write ip6tables rules to block ipv6 fragmented packets which are malformed.
This is basically for the ipv6 certification of our appliance box. We are running at: rhel 5.5 and kernel : 2.6.18-238.1.1.el5
The tests we are failing currently are:
1) Fragment Reassembly -- Fragment ID mismatch should give error 2) Fragment Reassembly -- Source Addresses Differ Between Fragments 3) Fragment Reassembly -- Destination Address Differ Between Fragments
Any other ideas to solve this is also welcome :)

We can solve this via tools like snort. Below are the steps to install, configure and run in RHEL 5.5
INSTALL PREREQUISITES
For the SNORT we need to install the following:
flex byacc bison pcre-devel libdnet-devel zlib-devel
We can download the above from:
ftp://ftp.univie.ac.at/systems/linux/dag/redhat/el5/en/x86_64/buildtools/RPMS/flex-2.5.35-0.8.el5.rfb.x86_64.rpm
ftp://fr2.rpmfind.net/linux/centos/5.10/os/x86_64/CentOS/byacc-1.9-29.2.2.x86_64.rpm
http://vault.centos.org/5.5/os/x86_64/CentOS/zlib-devel-1.2.3-3.x86_64.rpm
http://vault.centos.org/5.5/os/x86_64/CentOS/bison-2.3-2.1.x86_64.rpm
http://vault.centos.org/5.5/os/x86_64/CentOS/pcre-devel-6.6-2.el5_1.7.x86_64.rpm
ftp://ftp.univie.ac.at/systems/linux/dag/redhat/el5/en/x86_64/dag/RPMS/libdnet-1.11-1.2.el5.rf.x86_64.rpm
http://apt.sw.be/redhat/el5/en/x86_64/rpmforge/RPMS/libdnet-devel-1.11-1.2.el5.rf.x86_64.rpm
* Install the above said rpm in the below order:
rpm -ivh flex-2.5.35-0.8.el5.rfb.x86_64.rpm
rpm -ivh byacc-1.9-29.2.2.x86_64.rpm
rpm -ivh zlib-devel-1.2.3-3.x86_64.rpm
rpm -ivh bison-2.3-2.1.x86_64.rpm
rpm -ivh pcre-devel-6.6-2.el5_1.7.x86_64.rpm
rpm -ivh libdnet-1.11-1.2.el5.rf.x86_64.rpm
rpm -ivh libdnet-devel-1.11-1.2.el5.rf.x86_64.rpm
DOWNLOAD THE REQUIRED SNORT & ALLIED LIBRARIES
http://www.tcpdump.org/release/libpcap-1.5.3.tar.gz
http://sourceforge.net/projects/snort.mirror/files/Snort%202.9.5.6/snort-2.9.5.6.tar.gz/download
http://sourceforge.net/projects/snort.mirror/files/Snort%202.9.5.6/daq-2.0.1.tar.gz/download
[ NOTE: The following assumes the above 3 are downloaded to the /opt/CSCOlumos/SNORT ]
INSTALL LIBPCAP
cd /opt/CSCOlumos/SNORT
tar -xf libpcap-1.5.3.tar.gz
mv libpcap-1.5.3 /usr/local/src/
cd /usr/local/src/libpcap-1.5.3
./configure --prefix=/usr
make
make install
/sbin/ldconfig
INSTALL DAQ AND SNORT
cd /opt/CSCOlumos/SNORT
tar -xf daq-2.0.1.tar.gz
cd daq-2.0.1
./configure
cd os-daq-modules
make
cd ..
make
make install
cd /opt/CSCOlumos/SNORT
tar -xf snort-2.9.5.6.tar.gz
cd snort-2.9.5.6
./configure
make
make install
FIXING THE libdnet LIBRARY ISSUES
cp -rp /usr/lib/vmware-tools/lib32/libdnet.so.1 /usr/local/lib/
/sbin/ldconfig
updated
mkdir -p /var/log/snort/
touch /var/log/snort/alert
TEST THE SNORT
snort --version
,,_ -> Snort! <-
o" )~ Version 2.9.5.6 GRE (Build 208)
'''' By Martin Roesch & The Snort Team: http://www.snort.org/snort/snort-team
Copyright (C) 1998-2013 Sourcefire, Inc., et al.
Using libpcap version 1.5.3
Using PCRE version: 6.6 06-Feb-2006
Using ZLIB version: 1.2.3
CONFIGURING THE IPV6 FILTER AND RUNNING
vi /opt/test/SNORT/SNORT.conf
preprocessor frag3_global: max_frags 65536
preprocessor frag3_engine: policy linux
bind_to 2001::99ed:d7c6:86f0:8e0a
detect_anomalies
preprocessor frag3_engine: policy linux detect_anomalies
Now run as:
snort -c /opt/test/SNORT/SNORT.conf
NOTE: here the 2001::99ed:d7c6:86f0:8e0a is the eth0 (communication interface) ipv6 address.

Related

how to add custom path for rpm dependencies

I am trying to install some software that's required glib 2.14
so I installed it with this tutorial: How to upgrade glibc from version 2.12 to 2.14 on CentOS?
the problem is glib 2.14 path is /opt/glibc-2.14/lib/libc.so.6
so when I try to install software using rpm i still getting this error:
error: Failed dependencies:
libc.so.6(GLIBC_2.14)(64bit) is needed by xyz-4.6.6-1.x86_64
libc.so.6(GLIBC_2.15)(64bit) is needed by xyz-4.6.6-1.x86_64
libc.so.6(GLIBC_2.17)(64bit) is needed by xyz-4.6.6-1.x86_64
how can I add the custom path for rpm dependencies?
It would help a bit if you gave us the name of the package you are trying to install. You can't just provide a path, RPM checks if it's got any packages on record that provide these libraries, and there aren't any. Here are a couple methods you could use:
Use --nodeps
If you already know that you have everything that is required, using --nodeps is completely fine IMO.
Create virtual packages for the missing libraries (advanced)
You are missing the following libraries: libc.so.6(GLIBC_2.14)(64bit) libc.so.6(GLIBC_2.15)(64bit) libc.so.6(GLIBC_2.17)(64bit).
Here's an example .spec file to create a virtual package that claims to provide these libraries:
Name: libc-virtual-provides
Provides: libc.so.6(GLIBC_2.14)(64bit)
Provides: libc.so.6(GLIBC_2.15)(64bit)
Provides: libc.so.6(GLIBC_2.17)(64bit)
Version: 1.0
Release: 1
Summary: Virtual package providing libc 2.14, 2.15, 2.17
License: Public domain
%description
Virtual package providing libc 2.14, 2.15, 2.17
%prep
%files
%changelog
To create a virtual package from this SPEC file, first create some directories:
mkdir -p ~/rpmbuild/BUILD ~/rpmbuild/BUILDROOT ~/rpmbuild/RPMS ~/rpmbuild/SOURCES ~/rpmbuild/SPECS ~/rpmbuild/SRPMS
Then copy the SPEC file into ~/rpmbuild/SPECS, and build an RPM:
cp virtual-glibc-provides.spec ~/rpmbuild/SPECS
cd ~/rpmbuild/SPECS
rpmbuild -ba virtual-glibc-provides.spec
You'll get output like this:
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.6Jni5u
+ umask 022
+ cd /home/.../rpmbuild/BUILD
+ exit 0
Processing files: glib2.14-virtual-provides-2.14-1.x86_64
Checking for unpackaged file(s): /usr/lib/rpm/check-files /home/.../rpmbuild/BUILDROOT/glib2.14-virtual-provides-2.14-1.x86_64
Wrote: /home/.../rpmbuild/SRPMS/glib2.14-virtual-provides-2.14-1.src.rpm
Wrote: /home/.../rpmbuild/RPMS/x86_64/glib2.14-virtual-provides-2.14-1.x86_64.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.YNj8gP
+ umask 022
+ cd /home/.../rpmbuild/BUILD
+ /bin/rm -rf /home/.../rpmbuild/BUILDROOT/glib2.14-virtual-provides-2.14-1.x86_64
+ exit 0
And you'll have your RPM under /home/.../rpmbuild/RPMS/, which you can then install using rpm -ivh ....rpm. You should then be able to install the other package without any problems.

Installing g++ 5 on Amazon Linux

I'm trying to install g++ 5.x on an EC2 instance running Amazon Linux; in Amazon's central repository the latest version is 4.8.3. What configuration to can I make to allow yum to find a newer gcc-c++ package?
Late to the party, but for those like me:
sudo yum install gcc72 gcc72-c++
For Amazon Linux 2, you have to install the following
sudo yum install -y gcc-c++
It's a requirement to install some Ruby gems that need native extensions
Installing gcc5:
# Install required libraries
sudo yum install libmpc-devel mpfr-devel gmp-devel
# Gather source code
export GCC_VERSION=5.5.0
cd /tmp
curl -o "gcc-${GCC_VERSION}.tar.gz" \
https://ftp.gnu.org/gnu/gcc/gcc-${GCC_VERSION}/gcc- ${GCC_VERSION}.tar.gz
tar xvzf "gcc-${GCC_VERSION}.tar.gz"
cd gcc-${GCC_VERSION}
# Configure and compile
./configure --with-system-zlib --disable-multilib --enable-languages=c,c++
make -j 8
# Install
sudo make install
Ensure /usr/local/bin/ is in your PATH
You may advantageously install version 7.3.0 released on 25th January 18 here
You can run yum whatprovides g++ and it will output a list of different packages versions that provide the the g++ file.
example output:
...
gcc-c++-7.3.1-12.amzn2.x86_64 : C++ support for GCC
Repo : amzn2-core
Matched from:
Filename : /usr/bin/g++
gcc-c++-7.3.1-13.amzn2.x86_64 : C++ support for GCC
Repo : amzn2-core
Matched from:
Filename : /usr/bin/g++
On Amazon Linux 2 you can run sudo yum groupinstall "Development Tools" which will install many compilers and dependencies including g++
Probably like "amazon linux ami release 2016.03", when you have gcc-4.8.3 .
This OS is very close to CentOS 7.2 / RHEL 7.
Please try : # yum install centos-release-scl
If OK, you can do : # yum install devtoolset-4-gcc-c++ ... and get g++, gcc version 5.2.1 .
Enabling "5.2.1" : $ scl enable devtoolset-4 bash . Be aware that the setting is valid for the current terminal session only.
If any issues, I can supply a link to the four packages required for g++, gcc.

Kernel build for CentOS 7: kernel-firmware not generated

I'm in the process of rebuilding the Linux kernel for Cent OS 7 to select a different preemption level.
My steps follow:
sudo yum install rpm-build redhat-rpm-config asciidoc hmaccalc perl-ExtUtils-Embed pesign xmlto audit-libs-devel binutils-devel elfutils-devel elfutils-libelf-devel ncurses-devel newt-devel numactl-devel pciutils-devel python-devel zlib-devel gcc patchutils bison make gcc redhat-rpm-config
mkdir -p ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
echo '%_topdir %(echo $HOME)/rpmbuild' > ~/.rpmmacros
wget http://vault.centos.org/7.2.1511/updates/Source/SPackages/kernel-3.10.0-327.4.4.el7.src.rpm
rpm -i kernel-3.10.0-327.4.4.el7.src.rpm
cd ~/rpmbuild/SPECS
rpmbuild -bp --target=$(uname -m) kernel.spec
Kernel in BUILD configured and config file copied in SOURCES
rpmbuild -bb --with firmware --without kabichk --without debug --without debug-info --without doc --target=`uname -m` kernel.spec 2> build-err.log | tee build-out.log
rpmbuild -bb --with firmware --without kabichk --without debug --without debug-info --without doc --target=noarch kernel.spec 2> build-err.log | tee build-out.log
(--without kabichk is needed because the new preemption level somehow breaks the current ABI)
The problem is that the package kernel-firmware gets not generated.
Any idea of what is missing ?
There doesn't appear to be a kernel-firmware package in CentOS 7 at all. And a quick search through the kernel spec file confirms that kernel-firmware doesn't appear anywhere in it.
There is a linux-firmware package though.
That package is built by the linux-firmware specfile.

TAHI compliance ( IPV6 ) in RHEL 5.5 [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
We are planning for the ipv6 logo certification for our appliance box. We are running the TAHI suite (http://tahi.org/) for certifying the ipv6 compliance. I changed most of my sysctl settings in the RHEL 5.5 box to get it working.
I am having hard time to resolve the following:
1) Fragment Reassembly -- Fragment ID mismatch should give error
2) Fragment Reassembly -- Source Addresses Differ Between Fragments
3) Fragment Reassembly -- Destination Address Differ Between Fragments
My current configuration in sysctl pertaining to IPv6 is:
net.ipv6.conf.default.accept_dad=2
net.ipv6.conf.all.accept_dad=2
net.ipv6.conf.eth0.accept_dad=2
net.ipv6.conf.eth0.use_tempaddr=0
Can this be done via the ip6tables ? Any ideas on how this can be configured in RHEL 5.5 ?
INSTALL PREREQUISITES
For the SNORT we need to install the following:
flex byacc bison pcre-devel libdnet-devel zlib-devel
We can download the above from:
ftp://ftp.univie.ac.at/systems/linux/dag/redhat/el5/en/x86_64/buildtools/RPMS/flex-2.5.35-0.8.el5.rfb.x86_64.rpm
ftp://fr2.rpmfind.net/linux/centos/5.10/os/x86_64/CentOS/byacc-1.9-29.2.2.x86_64.rpm
http://vault.centos.org/5.5/os/x86_64/CentOS/zlib-devel-1.2.3-3.x86_64.rpm
http://vault.centos.org/5.5/os/x86_64/CentOS/bison-2.3-2.1.x86_64.rpm
http://vault.centos.org/5.5/os/x86_64/CentOS/pcre-devel-6.6-2.el5_1.7.x86_64.rpm
ftp://ftp.univie.ac.at/systems/linux/dag/redhat/el5/en/x86_64/dag/RPMS/libdnet-1.11-1.2.el5.rf.x86_64.rpm
http://apt.sw.be/redhat/el5/en/x86_64/rpmforge/RPMS/libdnet-devel-1.11-1.2.el5.rf.x86_64.rpm
* Install the above said rpm in the below order:
rpm -ivh flex-2.5.35-0.8.el5.rfb.x86_64.rpm
rpm -ivh byacc-1.9-29.2.2.x86_64.rpm
rpm -ivh zlib-devel-1.2.3-3.x86_64.rpm
rpm -ivh bison-2.3-2.1.x86_64.rpm
rpm -ivh pcre-devel-6.6-2.el5_1.7.x86_64.rpm
rpm -ivh libdnet-1.11-1.2.el5.rf.x86_64.rpm
rpm -ivh libdnet-devel-1.11-1.2.el5.rf.x86_64.rpm
DOWNLOAD THE REQUIRED SNORT & ALLIED LIBRARIES
http://www.tcpdump.org/release/libpcap-1.5.3.tar.gz
http://sourceforge.net/projects/snort.mirror/files/Snort%202.9.5.6/snort-2.9.5.6.tar.gz/download
http://sourceforge.net/projects/snort.mirror/files/Snort%202.9.5.6/daq-2.0.1.tar.gz/download
[ NOTE: The following assumes the above 3 are downloaded to the /opt/CSCOlumos/SNORT ]
INSTALL LIBPCAP
cd /opt/CSCOlumos/SNORT
tar -xf libpcap-1.5.3.tar.gz
mv libpcap-1.5.3 /usr/local/src/
cd /usr/local/src/libpcap-1.5.3
./configure --prefix=/usr
make
make install
/sbin/ldconfig
INSTALL DAQ AND SNORT
cd /opt/CSCOlumos/SNORT
tar -xf daq-2.0.1.tar.gz
cd daq-2.0.1
./configure
cd os-daq-modules
make
cd ..
make
make install
cd /opt/CSCOlumos/SNORT
tar -xf snort-2.9.5.6.tar.gz
cd snort-2.9.5.6
./configure
make
make install
FIXING THE libdnet LIBRARY ISSUES
cp -rp /usr/lib/vmware-tools/lib32/libdnet.so.1 /usr/local/lib/
/sbin/ldconfig
updated
mkdir -p /var/log/snort/
touch /var/log/snort/alert
TEST THE SNORT
snort --version
,,_ -> Snort! <-
o" )~ Version 2.9.5.6 GRE (Build 208)
'''' By Martin Roesch & The Snort Team: http://www.snort.org/snort/snort-team
Copyright (C) 1998-2013 Sourcefire, Inc., et al.
Using libpcap version 1.5.3
Using PCRE version: 6.6 06-Feb-2006
Using ZLIB version: 1.2.3
CONFIGURING THE IPV6 FILTER AND RUNNING
vi /opt/test/SNORT/SNORT.conf
preprocessor frag3_global: max_frags 65536
preprocessor frag3_engine: policy linux
bind_to 2001::99ed:d7c6:86f0:8e0a
detect_anomalies
preprocessor frag3_engine: policy linux detect_anomalies
Now run as:
snort -c /opt/test/SNORT/SNORT.conf
NOTE: here the 2001::99ed:d7c6:86f0:8e0a is the eth0 (communication interface) ipv6 address.

RPM + cant find rpm after rpm install

please advice why I cant find the rpm that I installed.
I am try to check by rpm -qa | grep test ( see the example in install the rpm: )
but seems that rpm isnt installed why?
build the RPM:
[root#linux /usr/src/redhat/SOURCES]# rpm -ba /usr/src/redhat/SPECS/my_spec.spec
Checking for unpackaged file(s): /usr/lib/rpm/check-files /var/tmp/test.sh
Wrote: /root/rpmbuild/SRPMS/test.sh-6.2-2.src.rpm
install the rpm:
[root#linux /usr/src/redhat/RPMS/i386]# rpm -Uvh /root/rpmbuild/SRPMS/test.sh-6.2-2.src.rpm
1:test.sh ########################################### [100%]
[root#linux /usr/src/redhat/RPMS/i386]# rpm -qa | grep test
no results ?
the spec file:
Summary: An example tool. To show a simple rpm build of the tool.
Name: test.sh
Version: 6.2
Release: 2
Source:/root/test.sh
Group: Development/Debuggers
BuildRoot:/var/tmp/test.sh
License: OtherLicense
%description
You installed the source rpm instead of the actual rpm:
rpm -Uvh /root/rpmbuild/RPMS/test.sh-6.2-2.rpm
rpmbuild outputs two files:
A source RPM (SRPM), located in SRPMS/
A binary RPM, located in RPMS//
As Wes noted, you've installed the SRPM. You need to install the RPM, which is located in your RPMS/i386/ subdir. Don't rename the SRPM, you need to look for the file located in the RPM folder and install it:
rpm -Uvh RPMS/i386s/test.sh-6.2-2.i386.rpm
When you install src.rpm it ends up in
~/rpmbuild/SPEC
~/rpmbuild/SOURCES
If you want to rebuild and get binary rpm you should:
rpmbuild -ba test.sh-6.2-2.src.rpm
or even better
mock test.sh-6.2-2.src.rpm
Try:
rpm -q test.sh-6.2-2
or
rpm -q test.sh-6.2-2.src

Resources