Jun 18, 2008

Restrict Access With Apache

In this document I hereby explain how to restrict access to a specified Directory in Apache.

My infrastructure is
Apache 2.2.6

For this example let’s say I want to protect a directory called private. Although your files may be in other locations, my files are located here:

Directory to protect: /var/www/htdocs/private
httpd.conf: /etc/apache/conf/httpd.conf

The very first thing to do is create an .htaccess file with following details right in the Directory
[root@server ] touch /var/www/htdocs/private/.htaccess
[root@server ] vi /var/www/htdocs/private/.htaccess

AuthType Basic
AuthUserFile /var/www/conf/.htpasswd
AuthName RestrictedArea
require valid-user
satisfy any

Here the .htpasswd file is storing the user name and password of authenticated users. You can specify this file any where in the directory.
Change its ownership and permissions

[root@server ]chown apache.apache /var/www/conf/.htpasswd
[root@server ]chmod 644 /var/www/conf/.htpasswd

Next lets add this following content in the httpd.conf file. Put the following content in the Directory Tag

[root@server]vi /etc/httpd/conf/httpd.conf

deny from all
Options ExecCGI
AllowOverride AuthConfig
Order deny,allow

Save and Exit

Now Lets add some users in the .htpasswd files

[root@server]htpasswd –bc /var/www/conf/.htpasswd admin passwd

OK,Now lets restart the Apache

[root@server]apachectl -k graceful

Check the Web server ports are listening.

[root@server]netstat -ntlp

If the 80 port is listening go to your favourite web browser and type the address. It will ask for user name and password to check in.Other wise you will get an internal server error. You may miss something. Check with your server logs.

Jun 11, 2008

Point-to-Point Tunneling Protocol in FC9 How-To

This article describe about how to setup a MPPE in Fedora 9.PPTP is used to connect a remote local network using Virtual Private Network. You can use this article in a COPY-PASTE method. It works fine for me. If you found any difficult while doing this,feel free to contact me

System Requirements

1.Kernel 2.6.15 or Later.

install MPPE capability:

MPPE is Microsoft Point-To-Point Encryption, and is described in RFC3078. You will need to install it if your PPTP Server requires it, and if your kernel is before 2.6.15. Microsoft Windows VPN Server requires MPPE. If you do not require MPPE, skip this step.

If you can upgrade to 2.6.15 or later, do so, then skip the remainder of this step.

1.Install the kernel-devel package for your kernel (or kernel-smp-devel if you are running an SMP kernel), for example:

# yum install kernel-devel

2.Check that your system is running the kernel corresponding to the package requested in the previous step. Use the uname command to display the version of the running kernel, for example:

# uname -r

If the version shown is not the version installed in the previous step, reboot into that kernel. Otherwise the dkms build below may fail, because the kernel package for the current kernel may not be installed.

3. install the dkms package:

# yum install dkms

4. download the kernel_ppp_mppe dkms rpm and install it:

# rpm --install kernel_ppp_mppe-1.0.2-3dkms.noarch.rpm

5. test that the MPPE module loads on request:

# modprobe ppp-compress-18 && echo success

Note: this may fail if the ppp_generic module was already loaded when the kernel_ppp_mppe package was installed, as the original module is replaced on disk but not in memory. Check this by unloading the module, e.g. using "rmmod ppp_generic" or rebooting. Then repeat the modprobe.

# download the PPTP client program pptp rpm and install it like this:

# rpm --install pptp-1.7.0-1.i386.rpm

Note: alternatively we've been told that you can get it from Fedora Extras, like this:

# yum install pptp

# verify that you have dependencies installed for the packages in the next step; (usually this is only a problem if you did a custom install):

# yum install libxml libglade

These packages are also available on the distribution media.

# download the configuration program interpreter php-pcntl rpm install it like this:

# rpm --install php-pcntl-4.4.0-1.i386.rpm

# download the configuration program GTK+ interface php-gtk-pcntl rpm (mirror link) and install it like this:

# rpm --install php-gtk-pcntl-1.0.2-1.i386.rpm

# download the configuration program pptpconfig rpm and install it like this:

# rpm --install pptpconfig-20040722-6.noarch.rpm


  • obtain from your PPTP Server administrator:

    • the IP address or host name of the server,
    • the authentication domain name, (e.g. WORKGROUP),
    • the username you are to use,
    • the password you are to use,
    • whether encryption is required.

  • run pptpconfig as root, and a window should appear,

  • enter the server, domain, username and password into the Server tab,

  • if you decided in Installation step 1 above that you would need MPPE, and if your administrator says encryption is required, then on the Encryption tab, click on Require Microsoft Point-to-Point Encryption (MPPE),

  • click on Add, and the tunnel will appear in the list,

  • click on the tunnel to select it, click on Start, and a window will appear with the tunnel connection log and status,