Oracle Database Application Security Book

Finally …

The Book is alive

For the first time the book which is dicussed critcal security issues such as database threats, and how to void them, the book also include advance topics about Oracle internet directory, Oracle access manager and how to implement full cycle single sign on,

Focus on the security aspects of designing, building, and maintaining a secure Oracle Database application. Starting with data encryption, you will learn to work with transparent data, back-up, and networks. You will then go through the key principles of audits, where you will get to know more about identity preservation, policies and fine-grained audits. Moving on to virtual private databases, you’ll set up and configure a VPD to work in concert with other security features in Oracle, followed by tips on managing configuration drift, profiles, and default users.

What You Will Learn:- 

  • Work with Oracle Internet Directory using the command-line and the console.
  • Integrate Oracle Access Manager with different applications.
  • Work with the Oracle Identity Manager console and connectors, while creating your own custom one.
  • Troubleshooting issues with OID, OAM, and OID.
  • Dive deep into file system and network security concepts.
  • First time chapter that include most of the critical database threats in real life.

 

You can buy the book now from amazon here

 

Cheers

Osama

Linux : Cannot Access …. Input/output error

/bin/ls: reading directory .: Input/output error
total 0

The above error indicate that i cannot access to the specific file on Linux, Delete not working. with root user as well.
so the error is not a problem to delete files, it’s a problem about the file system itself and/or an hardware problem, but before announce that it’s hardware issue 🙂 try the below solution :-

 Option #1:-

use command dmesg.

(display message or driver message) is a command on most Linux- and Unix-based operating systems that prints the message buffer of the kernel. Read about that command here

Option #2 ( worked for me)

Use Fsck command to detect filesystem error and fix it.

How !!!

  1.  First Umount File system ( that file located ). Using Umount command if it’s not able to un mount the file system use lsof command or fuser to check which user using this filesystem.
  2. run the fsck -y /dev/…………….. 
  3. mount file system again.
Fsck Command here
Cheers
Osama …

unrecognized class file version

This error appear on linux while trying to run iwae.sh ( Oracle Application adapter ).

Starting java

—————————————————————
Exception in thread “main” java.lang.ClassFormatError: com.ibi.bse.gui.BseFlashScreen (unrecognized class file version)
at java.lang.VMClassLoader.defineClass(libgcj.so.7rh)
at java.lang.ClassLoader.defineClass(libgcj.so.7rh)
at java.security.SecureClassLoader.defineClass(libgcj.so.7rh)
at java.net.URLClassLoader.findClass(libgcj.so.7rh)
at java.lang.ClassLoader.loadClass(libgcj.so.7rh)
at java.lang.ClassLoader.loadClass(libgcj.so.7rh)
at gnu.java.lang.MainThread.run(libgcj.so.7rh)

Solution :-

 export JAVACMD=/Oracle/Java/bin/java

And try again.

Thank you
Osama mustafa 

Extend LVM Disk Linux

This Article Will Describe step by step how to extend LVM Disk On Linux :-

1- After adding New Harddisk to the server you have to ReScan The Scsi using 

echo “- – -” > /sys/class/scsi_host/host?/scan

? :- Depend on you host number. 

2-  Use Fdisk to create new partition.

>fdisk -l
Disk /dev/sda: 107.3 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14       13054   104751832+  8e  Linux LVM
Disk /dev/sdb: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdb doesn’t contain a valid partition table

 Check the below :-

#fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklab el
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won’t be recoverable.

The number of cylinders for this disk is set to 1305.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1305, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1305, default 1305):
Using default value 1305

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.

3-  Lets start increasing :-

pvcreate /dev/sdb1
Writing physical volume data to disk “/dev/sdb1”
Physical volume “/dev/sdb1” successfully created

vgdisplay
— Volume group —
VG Name Oracle
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 4
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 3
Open LV 3
Max PV 0
Cur PV 1
Act PV 1
VG Size 99.88 GB
PE Size 32.00 MB
Total PE 3196
Alloc PE / Size 3196 / 99.88 GB
Free PE / Size 0 / 0
VG UUID MZ04D3-jZLy-0BWi-2WSP-oi9E-hBkl-e3a08d

vgextend Oracle /dev/sdb1  Volume group “Oracle” successfully extended

 pvscan
  PV /dev/sda2   VG Oracle   lvm2 [99.88 GB / 0    free]
  PV /dev/sdb1   VG Oracle   lvm2 [9.97 GB / 9.97 GB free]
  Total: 2 [109.84 GB] / in use: 2 [109.84 GB] / in no VG: 0 [0   ]

###

lvdisplay
— Logical volume —
LV Name /dev/Oracle/LogVol00
VG Name Oracle
LV UUID wKMZ16-LHsc-ktsc-3dTT-ieiq-pEfT-tODhqc
LV Write Access read/write
LV Status available
# open 1
LV Size 9.75 GB
Current LE 312
Segments 1
Allocation inherit
Read ahead sectors auto
– currently set to 256
Block device 253:0

— Logical volume —
LV Name /dev/Oracle/LogVol02
VG Name Oracle
LV UUID UabZCO-G8ID-dh1a-xv6t-Ss4O-QqEx-fnIy5g
LV Write Access read/write
LV Status available
# open 1
LV Size 82.34 GB
Current LE 2635
Segments 1
Allocation inherit
Read ahead sectors auto
– currently set to 256
Block device 253:1

— Logical volume —
LV Name /dev/Oracle/LogVol01
VG Name Oracle
LV UUID 78Y3bv-UZZI-Iu2w-gAyD-HXe1-Fx25-gmGuKn
LV Write Access read/write
LV Status available
# open 1
LV Size 7.78 GB
Current LE 249
Segments 1
Allocation inherit
Read ahead sectors auto
– currently set to 256
Block device 253:2

Now Let’s Extend :-

lvextend /dev/Oracle/LogVol00 /dev/sdb1 Extending logical volume LogVol00 to 19.72 GB
Logical volume LogVol00 successfully resized

 Finally :-

resize2fs /dev/Oracle/LogVol00resize2fs 1.39 (29-May-2006)
Filesystem at /dev/Oracle/LogVol00 is mounted on /; on-line resizing required
Performing an on-line resize of /dev/Oracle/LogVol00 to 5169152 (4k) blocks.

Notes :

  1. The Red Color for Command Line.
  2. The Brown Color For necessary Output. 
  3. /dev/Oracle/LogVol00 it’s the name for LVM Disk.
  4. /dev/sdb1 disk that we created using fdisk.

Thank you
Osama Mustafa

Flush Linux Buffer Cache

Cache is used to keep data to use frequently by operating system,  But sometimes memory is getting low linux provide some memory Command line to monitor Memory status Check the below link :-

1- Linux Check Memory Usage Here.
2- 18 Command Line Tools to Monitor Linux Performance here.

There are options available to flush cache of linux memeory :-

Flush everything ( Pagecache, dentries and inodes )  :-

 sync; echo 3 > /proc/sys/vm/drop_caches.

Flash dentries and inodes :-

 sync; echo 2 > /proc/sys/vm/drop_caches

Flash PageCache only

sync; echo 1 > /proc/sys/vm/drop_caches

All the command should be Run As root.

Schudle the above command as job using crontab , choose from the above command what you need :-

0  *  *  *  *  /root/memory.sh

Memorysh –> should be contain one the above script run as root.

Thank you
Osama mustafa

 

Share Folder as File System From Windows to Linux

in this post i will show you how to share folder from windows to Linux , you can use smb but in this post i will use it in command line.

Option #1:
SMB

By Press ( ALT+F2 ) the new dialog will be opened just type in the box the below :

smb://windows-server-ip/shared folder 

Option #2: 
Using command line.
  • mkdir /windows-backup
  • as root user
  • mount -t cifs //windowsip/sharefolder -o username=administrator,password=administratorpassword /windows-backup.
  • run df -h to make sure the folder has been mounted.
Note :
If you are using RHEL 4 the above command will not work, check the below

mount -t smbfs -o username=administrator,password=administratorpassword //windowsip/backup /windwos-backup

Thank you
Osama mustafa

Reference :
1- cyberciti Here

Change OHS Port On Linux to Work on 80

Operating system : Oracle Linux 6.4
Oracle WebTier OHS 11.1.1.7

if you want to configure OHS ( WT ) to work on port 80 ( http ) avoiding insert Port.

For Example :

OHS default Port is 7777, if you want to leave it like this any call for the server should be like this :

http://:7777/console  

But if you are using port 80 you have to do the below :

http:///console 

But on Linux if you need to use port 80 you have to be root, to do this follow the below step :

  • As root user :

[root@TST-WT1 bin]# pwd
/u01/fmw/Oracle_WT1/ohs/bin 

[root@TST-WT1 bin]# chown root .apachectl
[root@TST-WT1 bin]# chmod 6750 .apachectl

  • As Oracle User

[oracle@TST-WT1 ~]$ cd /u01/fmw/admin/config/OHS/ohs1/ 

[oracle@SCADNP-WT1 ohs1]$ ls http*
 httpd.conf      

  • Edit the file using any Editor and modify Listen from 7777 to 80
  • Restart OHS using opmnctl command.

——–+———-+———–+——
ohs1                             | OHS                |   15732 | Alive    |  677601509 |   510840 |   0:00:11 | https:9999,https:4443,http:80
Thank you 
Osama Mustafa

Configure Linux NFS File System

NFS : Network File System

Before Start Configure NFS you have to Understand When to use it ? and What is it ?

NFS file system usually read from Source Called Server , If this server goes down, it will not be available for the other resource, From this we understand that i should configure NFS On both Side Server and Client.

Read More About it Here.

Note : 

Server IP : 192.168.1.100
Client IP : 192.168.1.101

In this Blog I will Use NFSV4 

1- You need to install two Package ( as root user )
**nfs-ultis-lib
**portmap ( if you are asking nfs4 this is not needed anymore )

2-  As Root Run the below Command to Start nfs Serivces :

[root@TEST share]# /etc/init.d/nfs start
Starting NFS services:                                     [  OK  ]
Starting NFS quotas:                                       [  OK  ]
Starting NFS mountd:                                      [  OK  ]
Stopping RPC idmapd:                                    [  OK  ]
Starting RPC idmapd:                                      [  OK  ]
Starting NFS daemon:                                     [  OK  ]

3- Create folder under /u01/app/shared , give permission to oracle and chmod 775 
4- on NFS Server ( you will own the folder ) , vi /etc/exports add the below line :

/u01/app/shared [Client-IP] (rw,sync,no_root_squash) 

5- NFS Server is done , Go to NFS Client ( Node 2 )  as root user run the below command :

#/etc/init.d/nfs start
#showmount -e 192.168.1.101

The Output Will be like the below :

Export list for 192.168.1.100:
/u01/app/shared 192.168.1.101

6-On Node 2 ( As Root User ) –> #  mount -t nfs 192.168.1.100:/u01/app/shared/ /u01/app/shared/
7- Check using df -h 

**Remove:-

8- umount /u01/app/shared ( on Node 2 ) 

Important Command :
showmount -e : Shows the available shares on your local machine
exportfs -v : Displays a list of shares files and options on a server

Thank you
Osama Mustafa

Enable Docker On Linux

Oracle Linux Released Before 2 week, i already blogged about this and mean while i was testing new features for Oracle Linux 6.5 which is simply amazing i will start writing about it.

Enable Docker , What is the Docker you can check the official Website to take look what i mean by Docker here .

If you tried to install Docker Directly you will get the below error :

[root@OEL6 u01]# rpm -ivh docker-io-0.7.0-14.el6.x86_64.rpm

warning: docker-io-0.7.0-14.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
error: Failed dependencies:
lxc is needed by docker-io-0.7.0-14.el6.x86_64

and if you need to install lxc package :

[root@OEL6 Packages]# rpm -ivh lxc-0.9.0-2.0.5.el6.x86_64.rpm 

warning: lxc-0.9.0-2.0.5.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
error: Failed dependencies:
libvirt is needed by lxc-0.9.0-2.0.5.el6.x86_64

So Let’s Start :

root@OEL6 Packages]# rpm -ivh libvirt-0.10.2-29.0.1.el6.x86_64.rpm 

warning: libvirt-0.10.2-29.0.1.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
error: Failed dependencies:
/usr/bin/qemu-img is needed by libvirt-0.10.2-29.0.1.el6.x86_64
ebtables is needed by libvirt-0.10.2-29.0.1.el6.x86_64
libnetcf.so.1()(64bit) is needed by libvirt-0.10.2-29.0.1.el6.x86_64
libnetcf.so.1(NETCF_1.0.0)(64bit) is needed by libvirt-0.10.2-29.0.1.el6.x86_64
libnetcf.so.1(NETCF_1.2.0)(64bit) is needed by libvirt-0.10.2-29.0.1.el6.x86_64
libnetcf.so.1(NETCF_1.3.0)(64bit) is needed by libvirt-0.10.2-29.0.1.el6.x86_64
libnetcf.so.1(NETCF_1.4.0)(64bit) is needed by libvirt-0.10.2-29.0.1.el6.x86_64
lzop is needed by libvirt-0.10.2-29.0.1.el6.x86_64
numad is needed by libvirt-0.10.2-29.0.1.el6.x86_64
radvd is needed by libvirt-0.10.2-29.0.1.el6.x86_64

First:

[root@OEL6 Packages]# rpm -ivh lzo

lzo-2.03-3.1.el6.x86_64.rpm       lzop-1.02-0.9.rc1.el6.x86_64.rpm
[root@OEL6 Packages]# rpm -ivh lzop-1.02-0.9.rc1.el6.x86_64.rpm 
warning: lzop-1.02-0.9.rc1.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Preparing…                ########################################### [100%]
   1:lzop                   ########################################### [100%]

Second :

[root@OEL6 Packages]# rpm -ivh numa

numactl-2.0.7-8.el6.i686.rpm
numactl-2.0.7-8.el6.x86_64.rpm
numactl-devel-2.0.7-8.el6.i686.rpm
numactl-devel-2.0.7-8.el6.x86_64.rpm
numad-0.5-9.20130814git.el6.x86_64.rpm

[root@OEL6 Packages]# rpm -ivh numad-0.5-9.20130814git.el6.x86_64.rpm 

warning: numad-0.5-9.20130814git.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Preparing…                ########################################### [100%]
   1:numad                  ########################################### [100%]

Third:
[root@OEL6 Packages]# rpm -ivh radvd-1.6-1.el6.x86_64.rpm 
warning: radvd-1.6-1.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Preparing…                ########################################### [100%]
   1:radvd                  ########################################### [100%]
Fourth :

[root@OEL6 Packages]# rpm -ivh augeas-libs-1.0.0-5.el6.x86_64.rpm
warning: augeas-libs-1.0.0-5.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Preparing…                ########################################### [100%]
   1:augeas-libs            ########################################### [100%]

[root@OEL6 Packages]# rpm -ivh netcf-libs-0.1.9-4.el6.x86_64.rpm
warning: netcf-libs-0.1.9-4.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Preparing…                ########################################### [100%]
   1:netcf-libs             ########################################### [100%]

Now you need to enable qemu-img like the below :

[root@OEL6 Packages]# rpm -ivh libgfortran-4.4.7-4.el6.x86_64.rpm
warning: libgfortran-4.4.7-4.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key                                                                              ID ec551f03: NOKEY
Preparing…                ########################################### [100%]
        package libgfortran-4.4.7-4.el6.x86_64 is already installed

[root@OEL6 Packages]# rpm -ivh qemu-img-0.12.1.2-2.415.el6.x86_64.rpm
warning: qemu-img-0.12.1.2-2.415.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature,                                                                              key ID ec551f03: NOKEY
error: Failed dependencies:
        libgfapi.so.0()(64bit) is needed by qemu-img-2:0.12.1.2-2.415.el6.x86_64
        libusbredirparser.so.1()(64bit) is needed by qemu-img-2:0.12.1.2-2.415.e                                                                             l6.x86_64
[root@OEL6 Packages]# rpm -ivh glusterfs-api-3.4.0.36rhs-1.0.1.el6.x86_64.rpm
warning: glusterfs-api-3.4.0.36rhs-1.0.1.el6.x86_64.rpm: Header V3 RSA/SHA256 Si                                                                             gnature, key ID ec551f03: NOKEY
Preparing…                ########################################### [100%]
   1:glusterfs-api          ########################################### [100%]
[root@OEL6 Packages]# rpm -ivh qemu-img-0.12.1.2-2.415.el6.x86_64.rpm
warning: qemu-img-0.12.1.2-2.415.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature,                                                                              key ID ec551f03: NOKEY
error: Failed dependencies:
        libusbredirparser.so.1()(64bit) is needed by qemu-img-2:0.12.1.2-2.415.e                                                                             l6.x86_64
[root@OEL6 Packages]# rpm -ivh usbredir-0.5.1-1.el6.x86_64.rpm
warning: usbredir-0.5.1-1.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, ke ID                                                                              ec551f03: NOKEY
Preparing…                ########################################### [100%]
   1:usbredir               ########################################### [100%]

[root@OEL6 Packages]# rpm -ivh qemu-img-0.12.1.2-2.415.el6.x86_64.rpm
warning: qemu-img-0.12.1.2-2.415.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature,                                                                              key ID ec551f03: NOKEY
Preparing…                ########################################### [100%]
   1:qemu-img               ########################################### [100%]

Finally the last Package :

[root@OEL6 Packages]# rpm -ivh ebtables-2.0.9-6.el6.x86_64.rpm
warning: ebtables-2.0.9-6.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Preparing…                ########################################### [100%]
   1:ebtables               ########################################### [100%]

[root@OEL6 Packages]# rpm -ivh libvirt-0.10.2-29.0.1.el6.x86_64.rpm

warning: libvirt-0.10.2-29.0.1.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Preparing…                ########################################### [100%]
   1:libvirt                ########################################### [100%]

we have to download two more package 

[root@OEL6 Packages]# rpm -ivh lxc-0.9.0-2.0.5.el6.x86_64.rpm

warning: lxc-0.9.0-2.0.5.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Preparing…                ########################################### [100%]
   1:lxc                    ########################################### [100%]

[root@OEL6 u01]# rpm -ivh docker-io-0.7.0-14.el6.x86_64.rpm
warning: docker-io-0.7.0-14.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing…                ########################################### [100%]
   1:docker-io              ########################################### [100%]

Now you Can Use Docker 🙂 I will post more blog about this Package and how to use.
Thank you 
Osama Mustafa