store | blogs | forums | twitter | facebook | wiki | mailing lists | downloads | support portal
Atomic Secure Linux
It is currently Sun May 19, 2013 7:47 pm

» Feed - Atomicorp

All times are UTC - 5 hours [ DST ]




Post new topic Reply to topic Share/Bookmark  [ 11 posts ] 
Author Message
 Post subject: xt_dscp errors
Unread postPosted: Wed Jun 27, 2012 10:43 am 
Offline
Forum Regular
Forum Regular

Joined: Tue Jun 09, 2009 12:57 pm
Posts: 133
OSSEC has a lot of alerts like this

Code:
modprobe: FATAL: Error inserting xt_dscp (/lib/modules/2.6.32.59-22.art.x86_64/kernel/net/netfilter/xt_dscp.ko): Operation not permitted


There is nothing in the WIKI or FAQ containing "xt_dscp"

Thanks

_________________
CentOS 6.3 (2.6.32.60-40.art.x86_64)
ASL 3.2.13-30.el6.art
Webmin 1.6.2
Virtualmin 3.99.gpl
Apache 2.2.15
PHP 5.3.3 (mod_fcgid/2.3.7)


Top
 Profile  
 
 Post subject: Re: xt_dscp errors
Unread postPosted: Wed Jun 27, 2012 1:12 pm 
Offline
Atomicorp Staff - Site Admin
Atomicorp Staff - Site Admin
User avatar

Joined: Thu Feb 07, 2008 7:49 pm
Posts: 3243
Location: Chantilly, VA
Please see this FAQ:

https://www.atomicorp.com/wiki/index.ph ... _permitted

_________________
Michael Shinn
Atomicorp - Security For Everyone

Co-Author of Troubleshooting Linux Firewalls.


Top
 Profile  
 
 Post subject: Re: xt_dscp errors
Unread postPosted: Wed Jun 27, 2012 2:38 pm 
Offline
Forum Regular
Forum Regular

Joined: Tue Jun 09, 2009 12:57 pm
Posts: 133
mikeshinn wrote:


Are you familiar with xt_dscp? It seems to be related to the firewall. Could this be the reason I am having problems with the ASL firewall (as per the open support ticket)? Please look into this.

_________________
CentOS 6.3 (2.6.32.60-40.art.x86_64)
ASL 3.2.13-30.el6.art
Webmin 1.6.2
Virtualmin 3.99.gpl
Apache 2.2.15
PHP 5.3.3 (mod_fcgid/2.3.7)


Top
 Profile  
 
 Post subject: Re: xt_dscp errors
Unread postPosted: Wed Jun 27, 2012 3:33 pm 
Offline
Atomicorp Staff - Site Admin
Atomicorp Staff - Site Admin
User avatar

Joined: Thu Feb 07, 2008 7:49 pm
Posts: 3243
Location: Chantilly, VA
No, that module has nothing to do with your open case on the firewall manager. It would not cause the issue you are experiencing.

If you want that module loaded, you'll need to set it to load on boot, or set the kernel per the FAQ above to not lock. We'll add this as a module that is forced in an upcoming release, it is a firewall kernel module but its not something the ASL firewall uses. The kernel module just lets create rules to match the value of the IPv4/IPv6 DSCP field. We do not do that.

Do you have rules that look at the DSCP field?

_________________
Michael Shinn
Atomicorp - Security For Everyone

Co-Author of Troubleshooting Linux Firewalls.


Top
 Profile  
 
 Post subject: Re: xt_dscp errors
Unread postPosted: Wed Jun 27, 2012 3:43 pm 
Offline
Forum Regular
Forum Regular

Joined: Tue Jun 09, 2009 12:57 pm
Posts: 133
mikeshinn wrote:
Do you have rules that look at the DSCP field?


no clue on how to answer that...

So do I copy /lib/modules/2.6.32.59-22.art.x86_64/kernel/net/netfilter/xt_dscp.ko to /etc/init.d/ then create a symlink to /etc/init.d/xt_dscp.ko in /etc/rc3.d/ ?

Also, S98 is already taken (by asl-firewall). Should I use S97 instead?

_________________
CentOS 6.3 (2.6.32.60-40.art.x86_64)
ASL 3.2.13-30.el6.art
Webmin 1.6.2
Virtualmin 3.99.gpl
Apache 2.2.15
PHP 5.3.3 (mod_fcgid/2.3.7)


Top
 Profile  
 
 Post subject: Re: xt_dscp errors
Unread postPosted: Wed Jun 27, 2012 4:28 pm 
Offline
Atomicorp Staff - Site Admin
Atomicorp Staff - Site Admin
User avatar

Joined: Thu Feb 07, 2008 7:49 pm
Posts: 3243
Location: Chantilly, VA
Thank you for the question. Anything before S99asl-mod runs, thats when the kernel is locked.

Setting up your system to load custom modules is explained in this FAQ:

https://www.atomicorp.com/wiki/index.ph ... el_modules.

Which I have included below for your convenience, specifically see option 1:

Quote:
Solution:

By default the ASL kernel doesn't allow loading (or unloading) of kernel modules during runtime to protect the system from kernel level rootkits and other malicious kernel level code. Once your system finished the boot up process ASL will lock the kernel preventing hackers from modifying your kernel and hiding malware on your system. When attempting to load modules dynamically, this may result in error messages such as this:

modprobe: WARNING: Error inserting sunrpc (/lib/modules/2.6.32.43-6.art.i686.PAE/kernel/net/sunrpc/sunrpc.ko): Unknown symbol in module, or unknown parameter (see dmesg) modprobe: WARNING: Error inserting auth_rpcgss (/lib/modules/2.6.32.43-6.art.i686.PAE/kernel/net/sunrpc/auth_gss/auth_rpcgss.ko): Unknown symbol in module, or unknown parameter (see dmesg)

You have two options with ASL:

1) Set the modules to load at boot and reboot your system.

This article: Installing custom kernel modules with ASL provides more information about setting up custom modules to load before ASL locks the kernel down.

2) Configure ASL to allow your kernel to be modified at any time.

This is NOT recommended and is highly insecure. Allowing kernel modules to dynamic load and unload on a running system makes it possible for an attacker to install a kernel module rootkit. Kernel level rootkits are the most difficult type of malware to detect and prevent. Once the kernel is compromised, the entire system is compromised and it may not be possible for you even detect that this as occurred. We highly recommend you load the modules you need on boot and let ASL lock the kernel. Remember, ASL prevents all LKM rootkits if module loading is prevented at runtime.

If you wish to use to make your kernel insecure and to allow dynamic module loading on the fly, log into the ASL GUI, click on ASL Configuration and change the setting ALLOW_kmod_loading to yes. You will then need to reboot the system for this change to take effect. ASL will report this, correctly, as a critical vulnerability in the system.

_________________
Michael Shinn
Atomicorp - Security For Everyone

Co-Author of Troubleshooting Linux Firewalls.


Top
 Profile  
 
 Post subject: Re: xt_dscp errors
Unread postPosted: Wed Jun 27, 2012 5:26 pm 
Offline
Forum Regular
Forum Regular

Joined: Tue Jun 09, 2009 12:57 pm
Posts: 133
mikeshinn wrote:
Thank you for the question. Anything before S99asl-mod runs, thats when the kernel is locked.

Setting up your system to load custom modules is explained in this FAQ:

https://www.atomicorp.com/wiki/index.ph ... el_modules.

Which I have included below for your convenience, specifically see option 1:

Quote:
Solution:

By default the ASL kernel doesn't allow loading (or unloading) of kernel modules during runtime to protect the system from kernel level rootkits and other malicious kernel level code. Once your system finished the boot up process ASL will lock the kernel preventing hackers from modifying your kernel and hiding malware on your system. When attempting to load modules dynamically, this may result in error messages such as this:

modprobe: WARNING: Error inserting sunrpc (/lib/modules/2.6.32.43-6.art.i686.PAE/kernel/net/sunrpc/sunrpc.ko): Unknown symbol in module, or unknown parameter (see dmesg) modprobe: WARNING: Error inserting auth_rpcgss (/lib/modules/2.6.32.43-6.art.i686.PAE/kernel/net/sunrpc/auth_gss/auth_rpcgss.ko): Unknown symbol in module, or unknown parameter (see dmesg)

You have two options with ASL:

1) Set the modules to load at boot and reboot your system.

This article: Installing custom kernel modules with ASL provides more information about setting up custom modules to load before ASL locks the kernel down.

2) Configure ASL to allow your kernel to be modified at any time.

This is NOT recommended and is highly insecure. Allowing kernel modules to dynamic load and unload on a running system makes it possible for an attacker to install a kernel module rootkit. Kernel level rootkits are the most difficult type of malware to detect and prevent. Once the kernel is compromised, the entire system is compromised and it may not be possible for you even detect that this as occurred. We highly recommend you load the modules you need on boot and let ASL lock the kernel. Remember, ASL prevents all LKM rootkits if module loading is prevented at runtime.

If you wish to use to make your kernel insecure and to allow dynamic module loading on the fly, log into the ASL GUI, click on ASL Configuration and change the setting ALLOW_kmod_loading to yes. You will then need to reboot the system for this change to take effect. ASL will report this, correctly, as a critical vulnerability in the system.


ok, I will use S97. I had read that already (option #1). The FAQ implies a certain amount of knowledge that I dont have: I still dont know if I should copy /lib/modules/2.6.32.59-22.art.x86_64/kernel/net/netfilter/xt_dscp.ko to /etc/init.d/ then create a symlink to /etc/init.d/xt_dscp.ko in /etc/rc3.d/

_________________
CentOS 6.3 (2.6.32.60-40.art.x86_64)
ASL 3.2.13-30.el6.art
Webmin 1.6.2
Virtualmin 3.99.gpl
Apache 2.2.15
PHP 5.3.3 (mod_fcgid/2.3.7)


Top
 Profile  
 
 Post subject: Re: xt_dscp errors
Unread postPosted: Wed Jun 27, 2012 6:01 pm 
Offline
Atomicorp Staff - Site Admin
Atomicorp Staff - Site Admin
User avatar

Joined: Thu Feb 07, 2008 7:49 pm
Posts: 3243
Location: Chantilly, VA
No, that will not work. Please see the article linked to in option 1 above, I've included the the option again for your convenience:

Quote:
1) Set the modules to load at boot and reboot your system.

This article: Installing custom kernel modules with ASL provides more information about setting up custom modules to load before ASL locks the kernel down.

_________________
Michael Shinn
Atomicorp - Security For Everyone

Co-Author of Troubleshooting Linux Firewalls.


Top
 Profile  
 
 Post subject: Re: xt_dscp errors
Unread postPosted: Wed Jun 27, 2012 6:24 pm 
Offline
Forum Regular
Forum Regular

Joined: Tue Jun 09, 2009 12:57 pm
Posts: 133
mikeshinn wrote:
No, that will not work. Please see the article linked to in option 1 above, I've included the the option again for your convenience:

Quote:
1) Set the modules to load at boot and reboot your system.

This article: Installing custom kernel modules with ASL provides more information about setting up custom modules to load before ASL locks the kernel down.


THATS exactly what I am trying to do via "copy /lib/modules/2.6.32.59-22.art.x86_64/kernel/net/netfilter/xt_dscp.ko to /etc/init.d/ then create a symlink to /etc/init.d/xt_dscp.ko in /etc/rc3.d/". The script part I am not listing because I have no problems knowing what to put in the script and which permissions to give it.

From my understanding thats HOW you "set up custom modules to load before ASL locks the kernel down".

_________________
CentOS 6.3 (2.6.32.60-40.art.x86_64)
ASL 3.2.13-30.el6.art
Webmin 1.6.2
Virtualmin 3.99.gpl
Apache 2.2.15
PHP 5.3.3 (mod_fcgid/2.3.7)


Top
 Profile  
 
 Post subject: Re: xt_dscp errors
Unread postPosted: Wed Jun 27, 2012 11:49 pm 
Offline
Atomicorp Staff - Site Admin
Atomicorp Staff - Site Admin
User avatar

Joined: Thu Feb 07, 2008 7:49 pm
Posts: 3243
Location: Chantilly, VA
So if you look at the article I linked to, you'll see that what you need to do is create a script to load a kernel module. Theres even an example script on that page, for the module that you want to load. So from the article:

https://www.atomicorp.com/wiki/index.ph ... s_with_ASL

It says:

"Inside that directory you will see scripts that start with S and K. S means do this on start, K means do this when the system shuts down. Scripts are run in numerical order, so S00 runs before S01. "

So .ko files are not scripts, they are kernel objects. You can't load them by creating a symlink to them, you have to tell the system to load them. Kernel modules are loaded in Linux via the command "modprobe". So you need to create a script to run that command. And example script is provided on that page, at this URL:

https://www.atomicorp.com/wiki/index.ph ... ple_script

And here is the example script from that page, included for your convenience:

#!/bin/bash
modprobe xt_dscp

You need to save that as a file, in /etc/rc3.d/ as the script S97custom_modules for example. Again, as explained on the page linked to in this thread, you need to set that file to be executable. Again, included here for your convenience from the page linked to in this thread is the command you need to run:

chmod u+x /etc/rc3.d/S97_custom_modules

I invite you to read the article linked to in this thread to understand how Linux systems start up, heres the link again:

https://www.atomicorp.com/wiki/index.ph ... ple_script

And heres the entire article for your convenience:

Quote:
Introduction

ASL protects Linux systems in many ways. One of the ways it protects Linux systems from kernel level rootkits is to lock the kernel from any additional changes. Unlike a normal Linux kernel, which can be modified on the fly and can have its code changed anytime - by a malicious person for example - an ASL kernel protects itself by preventing these changes. ASL does this at the end of the init process, or the boot up process in Linux.

Specifically, ASL locks the kernel right at the end of the process or at position S99. ASL will load whatever modules the system is configured to load during boot and once that is complete it will prevent any future changes to the kernel.

This is the default behavior for ASL, to lock the kernel. So, if you stuck to the defaults (which we recommend, allowing the kernel change on the fly is very insecure and is not necessary), or if you set ASL to lock the kernel (which you are highly encouraged to do) you will see an error if you try to load a kernel module once the system finishes booting up.

To load custom modules you need to configure the system to do this during boot up, and the best place to do that is before init reaches position S99. The rest of this article explains init, what it does, what those positions are and how we recommend you load custom modules. This will vary from system to system as you may need to load those modules earlier in the init process.. Therefore check with your OS or third party product vendor to find out where in the boot process to load those modules.

Your other option is to configure ASL to behave like a normal Linux kernel, this is to allow the kernel to modified at any time, by malicious and non-malicious users. You can do that by logging into the ASL GUI, click on ASL Configuration, scroll down to kernel and set modules to load. You will then need to reboot your system. We do not recommend you set this and ASL will alert you to this vulnerable condition your system is now in.

init primer

init is the master program, if you will, for all UNIX systems (init is not part of ASL, please contact your OS vendor for support with init). Everything is a child of init, its process 1. (And no, you can't kill it - go ahead! Its safe!)

So when the system starts up init will start up everything for you, and carry out all the tasks needed to setup the system - like turning on networking and loading modules. init does this by "runlevel", these levels roughly correlate to the "function" of the system - dont get hung up on this, UNIX is OLD so these are concepts that dont matter as much as they used to. When init starts it checks the file /etc/inittab - that file tells it the "run level" to start up. This allows a UNIX system to basically have different levels or configurations depending on need. In practice, this isnt really used by most people. In practice most Linux systems will either start run level "3" or run level "5". These levels basically mean:

3 - multi user system with remote services (a server)

5 - multi users system with remote services and a big heavy GUI (a desktop basically)

And in case anyone is wondering, 2 used to mean multi-user server but without things like NFS, etc. And run level 1 is "single user" a special mode that starts UNIX/Linux in todays world into a maintainence/oh my god I broke it mode. (In the past it actually meant single user)

The levels ultimately are arbitrary, and heres why. All that happens when you tell init to run at a "level" is that it runs the scripts in a different directory. You see, init just runs in numerical order all the scripts in one of these directories:

/etc/rc1.d/
/etc/rc2.d/
/etc/rc3.d/
/etc/rc4.d/
/etc/rc5.d/

And those numbers refer to run levels. So, if you look in /etc/inittab you'll see a line like this:

id:3:initdefault:

So that tells init to run every script in this directory - and only the scripts in this directory:

/etc/rc3.d/

Inside that directory you will see scripts that start with S and K. S means do this on start, K means do this when the system shuts down. Scripts are run in numerical order, so S00 runs before S01. S10 runs before S99, and so on. ASL locks the kernel at positions S99, so any init script running before S99 can load/unload all the modules it wants.

In modern Linux systems you will see all the files in /etc/rcN.d (where N is a number as expressed above) as symlinks to this directory:

/etc/init.d/

That directory is typically where the actual scripts are to prevent duplication of the scripts in all the /etc/rcN.d/ directories.
[edit] Load the custom module

So, if you want to load modules before S99, then create a script in /etc/rc3.d/ with a number less than 99. S98_custom_modules for example.

You can also put your custom module script in /etc/init.d/ and symlink to it like this:

ln -s /etc/init.d/custom_modules S98custom_modules

You do not have to do it this way, you can also put your script in the /etc/rcN.d directory that is correct for your system, you can also just modify the init scripts to load whatever modules you when those scripts run.

Example script


This is an example Linux bash script, which init uses to configure the system on boot. All shell scripts (bash is a shell script) require a token to start the script to tell the system that this is a both a script, and what interpreter to use to execute the script. The first line in the script is the token. The following lines contains commands that the interpreter, in this case "/bin/bash" will understand. Think of this as a list of commands you can run in the Linux shell.

<pre>
#!/bin/bash
modprobe xt_dscp
</pre>

Linux uses a special userspace tool called "modprobe" to insert kernel modules. You simply need to provide the name of the module to load it. You do not need to include the .ko in the module name, just the name of the module. For example, to load the xt_dscp.ko module you just need to use the name "xt_dscp" as in the example above.

Save this script on the system using a text edit.

Note: Microsoft based text editors will not save files in a format that works on UNIX based systems. They place ^Ms at the end of every line, if you create a script in a Microsoft based editor you will need to fix the format of the file. Fortunately on UNIX based systems, like Linux, there is a command to do this. Just use the command "dos2unix <filename>" to fix the file, where <filename> is the literal filename to be fixed. For example:

dos2unix S97_custom_modules

This will fix the file.

For a script to run it also needs to have permission to execute, so when you save the file to your /etc/rcN.d directory, make sure its executable. A simple way to do that is to run this command as root:

chmod u+x /etc/rcN.d/S97_custom_modules

Again, read this entire article so you know what to change "N" to, as there is no /etc/rcN.d directory.

_________________
Michael Shinn
Atomicorp - Security For Everyone

Co-Author of Troubleshooting Linux Firewalls.


Top
 Profile  
 
 Post subject: Re: xt_dscp errors
Unread postPosted: Thu Jun 28, 2012 10:15 am 
Offline
Forum Regular
Forum Regular

Joined: Tue Jun 09, 2009 12:57 pm
Posts: 133
mikeshinn wrote:
So .ko files are not scripts, they are kernel objects. You can't load them by creating a symlink to them, you have to tell the system to load them.

Kernel modules are loaded in Linux via the command "modprobe". So you need to create a script to run that command.


Those two lines, which to you are obvious, make a world of difference. You should not imply that a newbie will know these two precepts, and that's exactly where I choked.

Thanks

_________________
CentOS 6.3 (2.6.32.60-40.art.x86_64)
ASL 3.2.13-30.el6.art
Webmin 1.6.2
Virtualmin 3.99.gpl
Apache 2.2.15
PHP 5.3.3 (mod_fcgid/2.3.7)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic Share/Bookmark  [ 11 posts ] 

» Feed - Atomicorp

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group