Skip navigation

Access restriction by IP 

The Administrative Panel will be available only from certain IP addresses or subnets. For example, address range 10.118.41.0/24.

For example, to allow access to the administrative panel for the address range 10.118.41.0/24, the file /etc/apache2/sites-available/portal.conf must have the following content:

<VirtualHost 127.0.0.1:88>
    DocumentRoot /var/www
    <Directory /var/www/stalker_portal/>
        Options -Indexes -MultiViews
        AllowOverride ALL
        Require all granted
    </Directory>
    <Directory /var/www/stalker_portal/server/adm/>
        Order Deny,Allow
            Deny from All
    	    Allow from 10.118.41.0/24
    </Directory>
    <Directory /var/www/stalker_portal/server/administrator/>
        Order Deny,Allow
            Deny from All
    	    Allow from 10.118.41.0/24
    </Directory>
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

 where Order indicates the order in which the rules will be processed - in the example, access is first denied for the entire Internet, then allowed for address range 10.118.41.0/24.

Restart apache :

service apache2 restart

The connection of additional authorization using the .htpasswd utility

Install the package apache2-utils

apt-get install apache2-utils

Generate a password file for the user:

htpasswd -c /etc/apache2/.htpasswd username 

As a result, a file will be created in which the user login (username) will be specified, having access to the directory /etc/apache2/

The file /etc/apache2/sites-available/portal.conf must have the following content:

<VirtualHost 127.0.0.1:88>
    DocumentRoot /var/www
    <Directory /var/www/stalker_portal/>
        Options -Indexes -MultiViews
        AllowOverride ALL
        Require all granted
    </Directory>
    <Directory /var/www/stalker_portal/server/adm/>
        AuthType Basic
        AuthName "Restricted Content"
        AuthUserFile /etc/apache2/.htpasswd
        Require valid-user
    </Directory>
    <Directory /var/www/stalker_portal/server/administrator/>
        AuthType Basic
        AuthName "Restricted Content"
        AuthUserFile /etc/apache2/.htpasswd
        Require valid-user
    </Directory>
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Restart apache :

service apache2 restart
Need Help

Cindy is an expert on the Ministra TV platform and the author of this article.

Was this article helpful?

Yes No

Sorry to hear that.
How can we improve this article?

We use cookies in order to optimise our website, provide you with the best possible user experience and help us promote our products. Please read our Cookie Policy to find out how we use cookies and how you can control cookies.
By using this website or closing this message, you acknowledge our Privacy Policy and agree to our use of cookies as described in our Cookie Policy.