5.0-Nano: Security & passwords: Difference between revisions

From The Uniform Server Wiki
Jump to navigation Jump to search
(New page: {{Nav 5.0-Nano}} '''Security and passwords''' New users may find Uniform Server’s security features a little bewildering this page attempts to explain their use and when passwords are ...)
 
mNo edit summary
 
Line 216: Line 216:
'''''Note 2'':''' Additional information can be found on the [[5.0-Nano: Security features | Security features]] page this includes Apanel's '''Security Center''' page  
'''''Note 2'':''' Additional information can be found on the [[5.0-Nano: Security features | Security features]] page this includes Apanel's '''Security Center''' page  


[[5.0-Nano: Known Issues | '''Next page'''] covers known issues and problems, where applicable offers solutions.


'''''[[#top | Top]]'''''
'''''[[#top | Top]]'''''

Latest revision as of 19:40, 11 September 2009

 

Security and passwords

New users may find Uniform Server’s security features a little bewildering this page attempts to explain their use and when passwords are required.

Top

Default installation

After extracting Uniform Server 5.0-Nano it’s ready to run and very secure. Apache and MySQL servers are locked down allowing only local access. No external access allowed from either Intranet or Internet hence while connected to these you can safely develop a web site.

Uniform Server 5.0-Nano achieves this lock down through the use of .htaccess files placed in each folder that is protected. The file also protects any sub-folders in that folder.

Each of these folders contains an .htaccess file:

\UniServer\home\admin\www – Control panel for the server
\UniServer\www            – Server web-root folder (your web site ) 
\UniServer\ssl            – Server secure web-root (your secure web site)

Open either of the .htacces files and you will find these three lines

Order Deny,Allow
Deny from all
Allow from 127.0.0.1 

The first line informs Apache to look for the next two lines and execute them in that order (Deny and then Allow)

The second line denies access to every one (all)

The third line is very specific and allows access from IP address 127.0.0.1 this is the IP address of the local machine. Hence Apache is locked down allowing only localhost access. (IP address 127.0.0.1 is also referred to as the local loop back address)

Top

Allowing external access

To put your servers on-line you need to allow external access this is achieved by commenting (adding a hash “#” to the beginning of each line) the three lines as shown below:

 
#Order Deny,Allow
#Deny from all
#Allow from 127.0.0.1

Alternatively you could delete the three lines.

With the lines commented everyone connected to the Internet or Intranet has access to the folders that the .htaccess file was protecting.

Your web site or sites are placed in the folders:

 
\UniServer\www  – Server web-root folder (your web site ) 
\UniServer\ssl  – Server secure web-root (your secure web site)

These are now available and pages will be served by Apache from these folders.

However modifying the .htaccess file in folder \UniServer\home\admin\www you will have allowed everyone access to your server’s control panel (kiss your servers goodbye). OK I was after a dramatic impact there are additional security features that prevents this however I recommend you do not place Apanel on-line, if you must! Make sure you enable name/password protection.

Top

Name Password protection

You may wish to prevent other Internet users accessing your server (a personal web server) this can be achieved by forcing a user to enter a name and password. Uniform Server has this facility pre-configured, Apanel allows you to set a name and password for three specific areas of the server. Under Configurations (left menu) you will find these three links:

  • Admin Panel Configuration
  • Private Server Configuration
  • Private Secure Server Configuration

After setting a name and password they do not become effective unless enabled in the appropriate .htaccess file, lets look at these in more detail.

Top

A) Admin Panel Configuration

If you have placed Apanel on-line it must be protected with a name and password as follows:

Edit file: \UniServer\home\admin\www\.htaccess

At the bottom of this file un-comment (remove the hash”#”) the last four lines as shown

AuthName "Uniform Server - Admin Panel 2.0"
AuthType Basic
AuthUserFile /htpasswd/home/admin/www/.htpasswd
Require valid-user

First line is the text displayed in the browser pop-up

Second line informs Apache the type of authentication (Basic)

Third line is the location of the file containing the name/password pair

The forth line forces Apache to instruct a browser a name and password are required.

Change name and password using Apanel, click on the link “Admin Panel Configuration” a new page opens showing current name/password. Enter new name/password click change.

Alternatively edit file /htpasswd/home/admin/www/.htpasswd and enter a name and password in the following format.

aname:apassword

Note: Do not add any additional characters or carriage return (enter key) after the password.

Test: Enter the following into your browser

http://localhost/apanel/

or

http://your_domain/apanel/

In both cases you will be challenged for a name and password.

Note: Default name and password are root:root

Top

B) Private Server Configuration

You can protect you web site with a name and password as follows:

Edit file: \UniServer\www\.htaccess

At the bottom of this file un-comment (remove the hash”#”) the last four lines as shown

AuthName "Uniform Server - Server Access"
AuthType Basic
AuthUserFile /htpasswd/www/.htpasswd
Require valid-user

First line is the text displayed in the browser pop-up

Second line informs Apache the type of authentication (Basic)

Third line is the location of the file containing the name/password pair

The forth line forces Apache to instruct a browser a name and password are required.

Change name and password using Apanel, click on the link “Private Server Configuration” a new page opens showing current name/password. Enter new name/password click change.

Alternatively edit file /htpasswd/www/.htpasswd and enter a name and password in the following format. aname:apassword

Note: Do not add any additional characters or carriage return (enter key) after the password.

Test: Enter the following into your browser

http://localhost

or

http://your_domain/

In both cases you will be challenged for a name and password.

Note: Default name and password are root:root

Top

C) Private Secure Server Configuration

You can protect you secure web site with a name and password as follows:

Edit file: \UniServer\ssl\.htaccess

At the bottom of this file un-comment (remove the hash”#”) the last four lines as shown

AuthName "Uniform Server - Server Access" 
AuthType Basic
AuthUserFile /htpasswd/ssl/.htpasswd
Require valid-user

First line is the text displayed in the browser pop-up

Second line informs Apache the type of authentication (Basic)

Third line is the location of the file containing the name/password pair

The forth line forces Apache to instruct a browser a name and password are required.

Change name and password using Apanel, click on the link “Private Secure Server Configuration” a new page opens showing current name/password. Enter new name/password click change.

Alternatively edit file /htpasswd/ssl/.htpasswd and enter a name and password in the following format. aname:apassword

Note: Do not add any additional characters or carriage return (enter key) after the password.

Test: Enter the following into your browser

https://localhost/

or

https://your_domain/

In both cases you will be challenged for a name and password.

Note 1: Default name and password are root:root

Note 2: Make sure you have generated a new server certificate and key as detailed on this page.

Top

MySQL Password

The MySQL server has been locked down for local access and protected by a password. If you have not put Apache on-line there is no need to change the password (default root). However it is good practice to change this at the earliest opportunity.

With Apache on-line there is a risk either through malicious intent or a rouge script to gain access to the MySQL server’s root user hence change the password. Note access remains local because user root has been restricted to local access.

To change the MySQL password use Apanel, click on the link “MySQL Server Configuration ” a new page opens showing current password (default root). Enter new password click change; there is no need to re-start the server.


Note 1: After changing either the MySQL port or password you may find server access is no longer possible using phpMyAdmin. A common cause is your browser cache close down servers and browser then restart.

Note 2: If for any reason the password becomes corrupted don’t panic use the password recovery link, found under Apanel's Plugin Manager section (left menu). Alternatively check out this page, how to manually create a new password.

Note 3: If you need to quickly back-up your databases no need to use phpMyAdmin or any other tool just back-up folder UniServer\usr\local\mysql\data this contains all databases.

Top

Summary

In terms of security if you are using the server for development there is nothing to do.

If you are putting the servers on-line they need to be enabled first by editing each of the .htaccess contained in each web-root folder (www and or ssl). Comment the lines as shown:

#Order Deny,Allow
#Deny from all
#Allow from 127.0.0.1

If you want a personal server with name/password access uncomment the last four lines in the above .htaccess files. Remember to change the name/password pairs using Apanel or manually edit the appropriate file.

Note 1: All names and passwords are set to a value of root

Note 2: Additional information can be found on the Security features page this includes Apanel's Security Center page

[[5.0-Nano: Known Issues | Next page] covers known issues and problems, where applicable offers solutions.

Top