Wednesday, 25 September 2013
arp-ping tool for windows
http://www.elifulkerson.com/projects/arp-ping.php
Wednesday, 18 September 2013
find unauthorized SUID and SGID system executables
The administrator
should take care to ensure that no rogue set-UID programs have been introduced
into the system. In addition, if possible, the administrator should attempt a
Set-UID audit and reduction. To check for these run the following script:
#!/bin/bash
for part in `awk '($3 == "ext2" || $3 == "ext3") { print $2 }' /etc/fstab`
do
find $part -xdev \( -perm -04000 -o -perm -02000 \) -type f -print
done
find unauthorized world writable files in linux
World writeable files can be modified by any user on the system. Generally removing write access for the "other" category (chmod o-w ) is advisable, but always consult the relevant documentation in order to avoid breaking any application dependencies on a particular file. Run the following script to print a list of world writeable files to screen. These files should then be reviewed and if possible the world writeable permissions removed.
#!/bin/bash
for part in `awk '($3 == "ext2" || $3 == "ext3") { print $2 }' /etc/fstab`
do
find $part -xdev -perm -0002 -type f -print | less
done
SELinux TFTP policy
If you have SELINUX
running SELINUX won't allow you to PUT or upload files to your TFTP server.
You can use "audit2allow" to allow you to create custom SELINUX policies
To use this you need to examine your servers audit logs. /var/log/audit/audit.log. This is where selinux logs errors. If you are receiving permission denied errors when uploading or puttiing files due to SELINUX have a check of this log. If SELINUX is causing the problem you will see an error log entry that looks like this:
type=AVC msg=audit(1245199930.280:31): avc: denied { write } for pid=2584 comm="in.tftpd" name="tftpboot" dev=dm-0 ino=1747009 scontext=system_u:system_r:tftpd_t:s0-s0:c0.c1023 tcontext=system_u:object_r:tftpdir_t:s0 tclass=dir
type=SYSCALL msg=audit(1245199930.280:31): arch=40000003 syscall=5 success=no exit=-13 a0=805e7a2 a1=8041 a2=1b6 a3=8041 items=0 ppid=2565 pid=2584 auid=4294967295 uid=99 gid=99 euid=99 suid=99 fsuid=99 egid=99 sgid=99 fsgid=99 tty=(none) ses=4294967295 comm="in.tftpd" exe="/usr/sbin/in.tftpd" subj=system_u:system_r:tftpd_t:s0-s0:c0.c1023 key=(null)
Using this error and the audit2allow tool we can create a policy that allows TFTP writes.
To use this you need to examine your servers audit logs. /var/log/audit/audit.log. This is where selinux logs errors. If you are receiving permission denied errors when uploading or puttiing files due to SELINUX have a check of this log. If SELINUX is causing the problem you will see an error log entry that looks like this:
type=AVC msg=audit(1245199930.280:31): avc: denied { write } for pid=2584 comm="in.tftpd" name="tftpboot" dev=dm-0 ino=1747009 scontext=system_u:system_r:tftpd_t:s0-s0:c0.c1023 tcontext=system_u:object_r:tftpdir_t:s0 tclass=dir
type=SYSCALL msg=audit(1245199930.280:31): arch=40000003 syscall=5 success=no exit=-13 a0=805e7a2 a1=8041 a2=1b6 a3=8041 items=0 ppid=2565 pid=2584 auid=4294967295 uid=99 gid=99 euid=99 suid=99 fsuid=99 egid=99 sgid=99 fsgid=99 tty=(none) ses=4294967295 comm="in.tftpd" exe="/usr/sbin/in.tftpd" subj=system_u:system_r:tftpd_t:s0-s0:c0.c1023 key=(null)
Using this error and the audit2allow tool we can create a policy that allows TFTP writes.
Step 1
Create some policy rules to load into SELINUX. Using the grep command input log entries which match our error from the audit file to the audit2allow tool.$ grep tftpd_t /var/log/audit/audit.log | audit2allow -M
tftplocal
NOTE!
The audit2allow tool isn't infallible and sometimes you might want to check the rules that are contained in the output module the above command has created aren't too relaxed. These rules are kept in a file called tftplocal.te that gets created as a result of the above command. It should look something like this:module tftplocal 1.0;
require {
type tftpd_t;
type tftpdir_t;
class dir { write };
class file { write };
}
#============= tftpd_t ==============
allow tftpd_t tftpdir_t:dir { write add_name };
allow tftpd_t tftpdir_t:file { write create };
Step 2
Import the selinux policy module created in step 1$ semodule -i tftplocal.ppchecking the status of a service in linux
In this example I want to see if SMB is running
Check the status:
/etc/init.d/smb status
I can restart a service with
/etc/init.d/smb stop
/etc/init.d/smb start
or simply
/etc/init.d/smb restart
Check if the service is set to start on boot up
chkconfig --list | grep smb
SELinux
SElinux can stop samba (and other things) from working. You can turn it off by running the following command as root
"setenforce 0"
This is not recommended as it disables other security features but no one seems to know how to create exceptions for SElinux. SElinux will start again after a reboot. To stop it starting on reboot
sudo vi /etc/selinux/config
change the line SELINUX=enforcing to SELINUX=permissive
Save your changes and that should be it.
Check the status:
/etc/init.d/smb status
I can restart a service with
/etc/init.d/smb stop
/etc/init.d/smb start
or simply
/etc/init.d/smb restart
Check if the service is set to start on boot up
chkconfig --list | grep smb
SELinux
SElinux can stop samba (and other things) from working. You can turn it off by running the following command as root
"setenforce 0"
This is not recommended as it disables other security features but no one seems to know how to create exceptions for SElinux. SElinux will start again after a reboot. To stop it starting on reboot
sudo vi /etc/selinux/config
change the line SELINUX=enforcing to SELINUX=permissive
Save your changes and that should be it.
How many CPU sockets does my server have?
$ egrep "processor|physical id|core id" /proc/cpuinfo
processor : 0
physical id : 0
core id : 0
processor : 1
physical id : 0
core id : 0
The output show is for a single socket dual core machine. Each core has a different processor ID, but the same physical ID (The physical ID indicating they are in fact on the same socket. A virtual machine will usually only show the processor line and not the physical or core id's.
processor : 0
physical id : 0
core id : 0
processor : 1
physical id : 0
core id : 0
The output show is for a single socket dual core machine. Each core has a different processor ID, but the same physical ID (The physical ID indicating they are in fact on the same socket. A virtual machine will usually only show the processor line and not the physical or core id's.
Subscribe to:
Posts (Atom)