A Journey of images

Server administration IPTABLES and IFTOP

Posted by: gerritvisagie on: November 8, 2011

If you are experiencing a problem with your webserver running slow or think you might have a dos attack on your hands, here is a trick i use to make sure i block any suspisious IP’s.

I use 2 packages on my Ubuntu server to have a look at what is going on.

Iftop easily obtained with

apt-get install iftop

Run it and have a look, it gives you the source ip and ports that are being accessed

 Press P to display ports  and N for DNS resolution

 Personally I prefer it off

 You can lookup any suspicious ip addresses  with ip-lookup.net/ 

Now you will have to look for any suspicious ip addresses that should not be accessing especially SSH and using high volumes of data especially any foreign servers accessing your port 25 (SMTP)

 Setup smtp authentication or block them off with a fire wall rule (see net section)

 If it does not originate from your country or any nabour countries  ones its a safe bet to block it, just ensure not to block the new technologies like the blackberry servers that originate from countries like the UK for  Africa.

 Next up is the all powerful IPTABLES

 Its installed by default on the server

 For a really nice extensive overview visit: https://help.ubuntu.com/community/IptablesHowTo

 Firstly  How to see if you have any rules on your firewall

 iptables –list

If the very first line reads 

 ACCEPT     all  –  anywhere             anywhere

  You will have to ensure to use the –I  option this writes the rule to the front of the list

 Iptables initializes rules from the top so ACCEPT all –anywhere will result in none of your rules below it working

 To stop a specific range:

iptables -I INPUT -p tcp -m iprange –src-range 180.0.0.0-180.255.255.255 -j DROP

 to block a specific ip use:

 iptables -I  INPUT -s 180.76.5.0  -j DROP

 and to drop a smtp connecter

 iptables -I  INPUT -s  196.215.3.214 -p smtp –dport 25  -j DROP

No phpmyadmin? Lets get that database

Posted by: gerritvisagie on: October 27, 2011

Cant find the phpmyadmin login of a website you need to backup? 

I found myself having this problem with a Joomla website that was about to transfer and a config file with just “Localhost” as the host address.  Plus a support center that closed at 5pm sharp. Dont we all  just love the bureaucratic way?

I was lucky that i had ftp details. if you dont have the ftp username. Wait for the support center to open… but if you do have the user here is a few quick things you can try to solve your problem.

Try pining the domain by opening command prompt.

run cmd.

type in: ping websiteadress.com

you should get somthing like this:



Now that you have the IP address of the server try typing into your url bar:
http://[your.ip.adress]:3306

Some hosts may redirect you to their phpmyadmin page .

Next up try http://88.10.315.138/phpmyadmin/

If your lucky this might also resolve your problem.

But if all else fails its time for some command line.

What you want to do is use the IP address to log into the SSH command line of the server.

Use a free ssh program like putty to connect to the address and utilize your ftp user to gain access to your folder

the following commands can be used:

mysqldump -u databaseusername -p –all-databases >alldatabase.sql

Dumps all your databases in the hosting package


mysqldump -u databaseusername -p db_name >alldatabase.sql

for use with specific databases


For a full list of functions: http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html

Do not forget the last >filename.sql or else you will only be dumping to screen.

Parse PHP files Help Apache recognize .php files

Posted by: gerritvisagie on: July 5, 2011

Ever installed a apache php5 server on ubuntu only to find that it is prompting you to download the pages instead of viewing them?

Well this is because you web server is not recognizing the .php extension.

To enable libapache2-mod-php

Run

sudo a2enmod php

and force reload with

/etc/init.d/apache2 force-reload

If you receve an error where the server says that the librairy could not be found try running

apt-get install libapache2-mod-php5

/etc/init.d/apache2 restart

Another fix if the problem persists:

cd /etc/apache2 

Go into mods-available, scroll down to php5.conf and php5.load

Copy php5.conf and php5.load to mods-enabled:

cp php5.conf  etc/apache2/mods-enabled

cp php5.load etc/apache2/mods-enabled

After that Restart your Web-server

sudo /etc/init.d/apache2 restart

Run local virtual hosts (xammp – apache – windows)

Posted by: gerritvisagie on: April 13, 2011

Tired of always using http://localhost/mysite ? want it to display mysite.com?

Well same here fellow Apache users.

Brows to your apache folder

>apache>conf>extra

Edit the httpd-vhosts.conf and add the following
(make sure to use the forward slash and not just copy and paste form the clipboard )

NameVirtualHost yourwebsite.com:80
<VirtualHost yourwebsite.com:80>
DocumentRoot C:/root/of/your/site
ServerName yourwebsite.com
</VirtualHost>

Make sure to also add your localhost to ensure your phpmyadmin and other extentions still work.

NameVirtualHost localhost:80
<VirtualHost localhost:80>
DocumentRoot C:/xampplite/htdocs
ServerName localhost.com
</VirtualHost>

Next up on your local drive go to:

C:\Windows\System32\drivers\etc

And edit the hosts file to look like this

127.0.0.1  localhost

127.0.0.1  yourwebsite.com

(Note do not define any real website addresses, this is your computers host setup file and will direct all references to the defined domain to the local machine)

Last and not least make sure your appache httpd.conf allows you to view files in the directory by adding

<Directory “C:/root/of/your/site/”>
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>

 

Note: Do not use any unsafe characters in folder names. If your apache does not start up after the changes, check the folder names for any spaces an spelling mistakes .

Categories

RSS Video Production | AD-land Corporate Video

  • The Final Product
    AD-land does small amount copies of up to 1000 copies for our clients. Designing the cover for the DVD case and the DVD itself is also within our capabilities.
  • Staff Training Videos
    Ad-land delivers high quality training videos for staff induction, training and orientation
  • Editing your Corporate Video
    The real art of editing lies in the combination of music, visuals and voice in such a way that it will keep the audience interested and sell your company.
  • Sales Presentations
    The structure of a sales presentation will mostly depend on the need of the company and the needs of their clients.
  • The key points to marketing video
    AD-land produce marketing videos that bring your message to life captivating your audience with sound and visuals of your business, striving to bring you interactive videos that get the job done.
  • Interactive Multimedia
    We create interactive multimedia for businesses; Delivering a professional level of interactivity is set by the design and application of the presentation.
  • Better Multimedia Presentations
    We are in the business of building multimedia presentations for clients. We cannot provide the content, but we can transform a presentation into something that will captivate the audience.
  • Safety Induction Video
    Ad-Land has produced this Safety Induction Video for BT Steel South Africa for their NOSA grading. The safety video with a total duration of 15 minutes and is a prime example of a Safety Induction Video.
  • News and Updates | Ad-land Productions
    Ad-land Productions, Production news, website updates, latest videos and website updates.Johannesburg South Africa. 0117952876 mail@ad-land.co.za
  • Audio Video Marketing
    Reach people through audio video marketing, a new and innovative way to show people what your company can do for them
Follow

Get every new post delivered to your Inbox.