Controlling access to /billing

From Kolmisoft Wiki

Jump to: navigation, search

[edit] BY IP address

Create (or Edit if exist) /var/www/html/billing/.htaccess and add following lines to the most bottom of the file:

Order Deny,Allow
Deny from all
Allow from friends_ip another_friends_ip

You can add multiple ip addresses, hostnames or diapazones.

Now restart apache:

/etc/init.d/httpd restart


info:

http://httpd.apache.org/docs/1.3/howto/htaccess.html

http://httpd.apache.org/docs/2.0/mod/mod_access.html#allow

http://httpd.apache.org/docs/1.3/mod/mod_access.html#allow



[edit] By Password

Create (or Edit if exist) /var/www/html/billing/.htaccess and add following lines:

AuthUserFile /var/www/html/billing/.htpasswd
AuthType Basic
AuthName "Password Protected Area"
Require valid-user

Then you have to create .htpasswd file which contains user and password:

htpasswd -b -m -c /var/www/html/billing/.htpasswd yourusername newpassword

omit "-c" if file already exist.


[edit] Using script:

svn update /usr/src/mor
/usr/src/mor/x5/gui/billing_htaccess_secure.sh 

This script does the following:

  1. Generates random password
  2. Creates /var/www/html/billing/.htaccess file with correct content
  3. Creates /var/www/html/billing/.htaccess file and adds password (generated in 1. step) for username 'admin'
  4. Outputs password in console
  5. Saves password into /root/MORhtaccessPassword file for later retrieval

Typical script output looks like this:

[root@mor ~]#  /usr/src/mor/x5/gui/billing_htaccess_secure.sh 
OK             Creating file .htpasswd in /var/www/html/billing/ directory
Adding password for user admin
NOTICE         Login and Password for MOR main page: admin 123456789
NOTICE         Password is saved into /root/MORhtaccessPassword file
OK             .htaccess configured for /var/www/html/billing/ directory
Personal tools

Try MOR

Try M2