OSOM (Open Source Open Mind) Conference will be held on 30th October 2010 (12pm-16pm)  at Cluj Napoca, Romania.

OSOM is design to reveal the general Open Source and Free Software concepts, the differences between the two trends and the types of licenses used in this area, to demonstrate that Open Source and Free Software is a valid replacement or complement to proprietary software.

What are our mainly topics of discussion?

1. “Open Source Culture” – The concept of open source and free sharing of technological information

2. Android application:

“Where to go?” – An application related to GPS navigation system

3. Widely used applications on open systems

4. Things they say open source tools cannot do…Performance in testing by Jmeter and SoapUI

5. Open source Caching Solutions –  In this article we present first a quick overview on caching, caching strategies and the use of caching for web pages and secondly few open source caching solutions along with their main features

6. Project Management and open source licenses

7. Digital Graphics – Alternative Solutions

8. Other topics

Here you can find OSOM program and Facebook page for this event.

Organizers:

Partners:

20. August 2010 · 9 comments · Categories: Linux
"Unable to connect to database: Too many connections" - common issue ...

Cause:
This error means that the limit of simultaneous MySQL connection to mysql server is
reached and new connections to the server cannot be established at this time.

Resolution:
There are two ways to solve this issue. The first one is increase the connection
limit and the second, find what is the reason of “too many connection” error and
try to lower MySQL server usage.

MySQL server state can be checked using ‘mysqladmin’ utility. For example to find out
the number of current connections to the server use:

#mysqladmin -uadmin -p extended-status | grep Max_used_connections
| Max_used_connections | 11 |

Current connections limit settings can be found with:

#mysqladmin -uadmin -p variables | grep 'max.*connections'
| max_connections | 100 |
| max_user_connections | 0

In the example above, maximum number of connections to the server (max_connections)
is set to 100. And maximum number of connections per user (max_user_connections)
to zero, that means unlimited.
There are default MySQL values. They can be redefined in /etc/my.cnf, for example:

[mysqld]
set-variable=max_connections=150
set-variable=max_user_connections=20

Restart MySQL after my.cnf is modified.

Note, if you set connections limit to very high value (more than 300) it may
affect the server performance. It is better to find out the reason of the high
MySQL server usage.
You may check what users/requests slow mysql and take all curent connections,
for example with the command:

# mysqladmin -uadmin -p processlist
In order to do this we have to create a file named .ftpaccess with the
following content:

 <Limit ALL> DenyALL
 Allow 127.0.0.1
 Allow IP(s)  ( if you have dynamic IP you have to set IP class like this:

Allow 1.2.3.
Allow 1.2.4.
Allow 1.2.5.
Allow 1.2.6.
Allow 1.2.7. )

 </Limit>

This file must be uploaded in httpdocs, httpsdocs, cgi and web users ...
That's it!

Here is a good website to check if your IP is on the blacklist …

09. July 2010 · 2 comments · Categories: Linux

A quick and useful command for checking if a server is under ddos:


netstat -anp |grep ‘tcp\|udp’ | awk ‘{print $5}’ | cut -d: -f1 | sort | uniq -c | sort -n


That will list the IPs taking the most amounts of connections to a server. It is important to remember that ddos is becoming more sophisticated and they are using fewer connections with more attacking ips. If this is the case you will still get low number of connections even while you are under a DDOS.

Another very important thing to look at is how many active connections your server is currently processing.


netstat -n | grep :80 |wc -l

netstat -n | grep :80 | grep SYN |wc -l


The first command will show the number of active connections that are open to your server. Many of the attacks typically seen work by starting a connection to the server and then not sending any reply making the server wait for it to time out. The number of active connections from the first command is going to vary widely but if you are much above 500 you are probably having problems. If the second command is over 100 you are having trouble with a syn attack.

To Block a certain IP address that on server .Please use following commands:


route add ipaddress reject


… for example: route add 192.168.0.168 reject

You can check whether given IP is blocked on server by using following command


route -n |grep IPaddress


Or use follwoing command to block a ip with iptables on server


iptables -A INPUT 1 -s IPADRESS -j DROP/REJECT

service iptables restart

service iptables save


Then KILL all httpd connection and restarted httpd service by using following command:


killall -KILL httpd

service httpd startssl


A simple command such as netstat -n -p|grep SYN_REC | wc -l would list all the active SYN_REC connections on the server… depending on the server’s size, 30 to 40 SYN_REC could be a sign of a DDOS attack.

Again, do not be fixed on numbers, different variant play when deciding to ring the DDOS emergency bell


netstat -n -p | grep SYN_REC | awk ‘{print $5}’ | awk -F: ‘{print $1}’ will therefore list all the IPs that are maintaining the SYN_REC connections.

A quick and useful command for checking if a server is under ddos:

netstat -anp |grep ‘tcp\|udp’ | awk ‘{print $5}’ | cut -d: -f1 | sort | uniq -c | sort -n

That will list the IPs taking the most amounts of connections to a server. It is important to remember that ddos is becoming more sophisticated and they are using fewer connections with more attacking ips. If this is the case you will still get low number of connections even while you are under a DDOS.

Another very important thing to look at is how many active connections your server is currently processing.

netstat -n | grep :80 |wc -l

netstat -n | grep :80 | grep SYN |wc -l

The first command will show the number of active connections that are open to your server. Many of the attacks typically seen work by starting a connection to the server and then not sending any reply making the server wait for it to time out. The number of active connections from the first command is going to vary widely but if you are much above 500 you are probably having problems. If the second command is over 100 you are having trouble with a syn attack.

To Block a certain IP address that on server .Please use following commands:

route add ipaddress reject

… for example: route add 192.168.0.168 reject

You can check whether given IP is blocked on server by using following command

route -n |grep IPaddress

Or use follwoing command to block a ip with iptables on server

iptables -A INPUT 1 -s IPADRESS -j DROP/REJECT

service iptables restart

service iptables save

Then KILL all httpd connection and restarted httpd service by using following command

killall -KILL httpd

service httpd startssl

A simple command such as netstat -n -p|grep SYN_REC | wc -l would list all the active SYN_REC connections on the server… depending on the server’s size, 30 to 40 SYN_REC could be a sign of a DDOS attack.

Again, do not be fixed on numbers, different variant play when deciding to ring the DDOS emergency bell

netstat -n -p | grep SYN_REC | awk ‘{print $5}’ | awk -F: ‘{print $1}’ will therefore list all the IPs that are maintaining the SYN_REC connections.

You can check your php memory limit using the phpinfo() function.

You need to create a php file and put into it :

<?php
phpinfo();
?>

This  will show your whole php settings from browser.
To alter the memory limit  you need to create a .htaccess file and put in it :

php_value memory_limit xxM

where  xx is the memory limit in M.

Your memory limit (globally set in php.ini) is 32M at this time. This can be altered

per domain with the .htaccess file mentioned above.

Recently I had to connect to a Microsoft SQL server … I have to say that I’m not a big Windows fan, in fact I’m not at all :), so I had to look for a workaround in order to not connect via Microsoft SQL Server Studio Express. I google it for a while and in the end I’ve found iODBC. This information applies to you if you are within Ubuntu and trying to connect to any type of Microsoft SQL (MSSQL) Server. To install it go into Synaptic Package Manager and search for this packages: iodbc, libiodbc2, libct3, tdsodbc and unixodbc. Or you can install these packages from command line using “apt-get install package“. The executable is located: /usr/bin/iodbcadm-gtk. After that go to home directory into terminal and edit .iodbc.ini file.

Contents of <.iodbc.ini>

[ODBC Data Sources]
ODBCdsn = ODBC Server
[ODBCdsn]
Driver      = /usr/lib/odbc/libtdsodbc.so
Description = ODBC Server
Trace       = No
Servername  = ODBC
Database    =         [name of your database]
[Default]
Driver = /usr/lib/odbc/libtdsodbc.so
We now need to setup the FreeTDS driver which does the translation for communications purposes to MSSQL.[pensacola@pensacola-tech ~]#gedit /etc/freetds/freetds.conf

Contents of <freetds.conf>

[ODBC]
host = xxx.xxx.xxx.xxx   [IP address of your database server]
port = 1433                      [Port of your database server]
tds version = 8.0              [Google:  FreeTDS if you are on a different version of MSSQL]

Startup the iODBC  we installed above.  Goto the User DSN tab.  Click test and authenticate with a valid username and password.

So there it is!

22. June 2010 · 79 comments · Categories: Linux

A Simple Database Backup:

You can use mysqldump to create a simple backup of your database using the following syntax.

mysqldump -u [username] -p [password] [databasename] > [backupfile.sql]

  • [username] – this is your database username
  • [password] – this is the password for your database
  • [databasename] – the name of your database
  • [backupfile.sql] – the file to which the backup should be written.

The resultant dump file will contain all the SQL statements needed to create the table and populate the table in a new database server. To backup your database ‘Data’ with the username ‘pensacola’ and password ‘password’ to a file customdata.sql, you would issue the command:

[pensacola@pensacola-tech ~]#mysqldump -u pensacola -p password Data > customdata.sql

Import your data into your database:

[pensacola@pensacola-tech ~]# mysqldump -u pensacola -p password Data < customdata.sql

Backup of Mysql database using phpMyAdmin:


It is assumed that you have phpMyAdmin installed since a lot of web service providers use it.

  • Open phpMyAdmin.
  • Click Export in the Menu to get to where you can backup you MySql database. Image showing the export menu.
  • Make sure that you have selected to export your entire database, and not just one table. There should be as many tables in the export list as showing under the database name.
  • Select”SQL”-> for output format, Check “Structure” and “Add AUTO_INCREMENT” value. Check “Enclose table and field name with backquotes”. Check “DATA”, check use “hexadecimal for binary field”. Export type set to “INSERT”.
  • Check “Save as file”, do not change the file name, use compression if you want. Then click “GO” to download the backup file.


Restoring a backup of a MySql database with phpMyAdmin:

  • To restore a database, you click the SQL tab.
  • On the “SQL”-page , unclick the show query here again.
  • Browse to your backup of the database.
  • Click Go.

AutoMySQLBackup

There is a script to take daily, weekly and monthly backups of your MySQL databases using mysqldump. You can download this script from here. This can be run using the following:

[pensacola@pensacola-tech ~]#sh automysqlbackup.sh.2.5

This is a very simple way for server administrator …

If you find AutoMySQLBackup valuable please make a donation at:

09. June 2010 · 2 comments · Categories: Linux

Here is a step by step on how to set up shared folders for accessing Windows folders in a Linux guest. VirtualBox Shared Folders on inactive virtual machines are configured through the Settings dialog. This dialog is accessed by selecting the desired virtual machine from the list and clicking the Settings button in the toolbar. Once the settings dialog is displayed, click on the Shared Folders entry to display something like this:

To add a new shared folder, click on the add folder button (the top button containing an icon of a folder with a green plus sign) and select a folder on the host system to be shared with the selected guest. To browse for a specific folder, click the down arrow in the Folder Path text box and select Other… from the drop down menu. Once a suitable folder has been selected, enter a name for the share in the Folder Name field. If the guest operating system is to be denied write access to the folder, ensure that the Read-only check box is selected before clicking the OK button to create the share. Once the shared folder has been configured, start the virtual machine to access the folder.

Shared folders may be configured on a running virtual machine by selecting the Devices->Shared Folders.. menu of the virtual machine window. It will be something like this:

Add a new shared folder by clicking on the add folder button (the top button containing an icon of a folder with a green plus sign) and select a folder on the host system to be shared with the selected guest.

Shared Folders are accessed on Linux guests by mounting the folder at a suitable mount point using the mount command. This can either be an existing directory, or a new directory may be created specifically for this purpose. Use this command: sudo mount -t vboxsf share ~/host

E.g

[pensacola@pensacola-tech ~]#sudo mkdir /media/shared_folder

[pensacola@pensacola-tech ~]#sudo mount -t vboxsf shared_folder /media/shared_folder

The files are now accessible in /media/shared_folder.

Plug in the USB-Serial Port adaptor to one of your USB port, wait for a couple of second, then run:

[pensacola@pensacola-tech ~]#dmesg

The output should be something like this:

usb 2.0: new full speed USB device using uhci_and address 2

usb 2.0: configuration #1 chosen from 1 choice

Then unplug the device and type:

[pensacola@pensacola-tech ~]#lsusb

The output should be similar to this:

Bus 003 Device 001: ID 0000:0000

Bus 002 Device 007: ID 03f0:4f11 Hewlett-Packard

Bus 002 Device 006: ID 05e3:1205

Bus 002 Device 004: ID 15d9:0a33

Plug in the USB-Serial Port converter back, and run “lsusb” again, and you will see
an additional line, like this:

Bus 003 Device 001: ID 0000:0000

Bus 002 Device 007: ID 03f0:4f11 Hewlett-Packard

Bus 001 Device 002: ID 4348:5523 — — — the additional line

Bus 002 Device 006: ID 05e3:1205

Bus 002 Device 004: ID 15d9:0a33

At this point we have the vendor id and the product id of the USB-Serial Port converter, this will enable us to load the linux kernel module “usbserial” to activate the device.
[pensacola@pensacola-tech ~]#sudo modprobe usbserial vendor=0x4348 product=0x5523

After that run again:

[pensacola@pensacola-tech ~]#dmesg

… the output:

usbserial_generic 2.0:1.0: generic converter detected

usb 2.0: generic converter now attached to ttyUSB0

usbcore: registered new interface driver usbserial_generic

Now, the new serial port device is mapped to /dev/ttyUSB0.

Note:  You can instruct Ubuntu to load this module automatically by include the line :  “usbserial vendor=0×4348 product=0×5523 inside “/etc/modules” file.

css.php