This blog site is not meant to be any information that is distributed to the general public. It is to serve as shared documentation between the DNSTC developers; however, if you find something useful and would like to use it, go right ahead.

Showing posts with label Server Side. Show all posts
Showing posts with label Server Side. Show all posts

Tuesday, February 23, 2016

Securing the Images Folder

It is required to secure any folder that has rights for uploading with locking it down so that coding cannot execute within the folders and subfolders of that directory structure.   The following code should be placed within an .htaccess file at the root of any folder that has access to upload or create files on the server.

Friday, December 14, 2012

IP Tables–and removing blocked IP

firewall-antivirusWe have been doing a lot of work lately with the firewall and IPtables.  I came across this blog site that is very handy when it comes to easily explaining Linux command line commands.  This site was extremely useful for removing IP addresses that got blocked do to people forgetting their passwords and trying to log in too many times. 

Here are some of the commands:

List IP’s that are being blocked with the line numbers:

iptables -L INPUT -n --line-numbers



Once you have the line number you can delete the entry

iptables -D INPUT 10



Saving the iptables listing

service iptables save



For the complete blog page and other great Linux stuff, visit: 
http://www.cyberciti.biz/faq/iptables-delete-ip-address-subnet-from-linux-firewall/

Wednesday, December 12, 2012

EXIM Cheat sheet

exim-blue-ldI Found a great web page that gave a nice cheat sheet for EXIM commands.  I wanted to document this page since I will be using most of the commands to develop an monitoring system that I can use on my phone and desktop widget.

The page is located at:  EXIM CHEETSHEET

Monday, February 6, 2012

Blocking IP addresses from the server

deniedI really got tired of dealing with spammers so I just started blocking IP address from these people who just want to submit garbage to our forms on the websites.  Here is how I block and IP address.

1. Log into the root account.

2. Enter the code below at the command prompt:

iptables -A INPUT -s x.x.x.x -j DROP



To list what is in the iptables:


iptables -L




That is pretty much it, and they should be shut-down from the server completely!

Tuesday, May 24, 2011

Scheduling Cron Jobs on Linux

Occasional we may need to setup some scheduled jobs for clients (or DNSTC websites). I found this website that explains the CRON utility pretty good and gives some great examples on how to modify and manage CRON jobs.

http://www.cyberciti.biz/faq/how-do-i-add-jobs-to-cron-under-linux-or-unix-oses/

Thursday, February 24, 2011

Password Protecting a Directory with .htaccess

There have been many occasions where password protecting a directory is the ultimate in web security. This can be used by clients to hide information that they do not want their public to know about or access, it can also be used to secure information for employees of a company.

Instead of writing a tutorial about this, I went to the "Net" and found a great web page resource that will actually create the password file for you...

Here is a quote from that page:

Password protecting a directory can be done several ways. Many people use PHP or ASP to verify users, but if you want to protect a directory of files or images (for example), that often isn't practical. Fortunately, Apache has a built-in method for protecting directories from prying eyes, using the .htaccess file.

In order to protect your chosen directory, you will first need to create an .htaccess file. This is the file that the server will check before allowing access to anything in the same directory. That's right, the .htaccess file belongs in the directory you are protecting, and you can have one in each of as many directories as you like.

The way the password protection works, if there is any page within that directory accessed, the users will be prompted to enter a username and password.

For more information about this: http://www.addedbytes.com/lab/password-protect-a-directory-with-htaccess/


 

Monday, February 14, 2011

Turning on PHP errors on the Server

By default, if there is a PHP error, it is not displayed on the screen to the user. This is done for security reasons, but it does not aid the programmer in troubleshooting the issue. If you place some code within the .htaccess file, you can turn on the error display. The following code is used to turn on the error display for troubleshooting purposes:



php_flag display_errors on
php_value error_reporting 7


To add this code, perform the following:

  1. Use putty to log into server.
  2. cd to the appropriate /home/<users>/www directory
  3. nano .htaccess
  4. Copy and paste the code above to the file
  5. Save the .htaccess file… control/o

If you now refresh the page, you should see the error and you can be off to troublshoot!