Restrict one website to a couple subnets only

Discussion in 'ISPConfig 3 Priority Support' started by rob_morin, Mar 12, 2019.

  1. rob_morin

    rob_morin Member

    Hello I have been trying to restrict access to a website to deny all and only let in a certain IP and certain subnets.
    I have tried adding to the options tab some require directives, but can't seem to get it to work. I was ok with the old method of deny all, allow IP, but times have changed. :)
    Any help appreciated.
    The below does not work for me in the options tab under Apache directives

    <Directory "/var/www/clients/client1/web4/web">
    Require all denied
    Require ip 192.168.2.0/24
    Require ip 173.176.xxx.xxx
    </Directory>
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Try to add the same stanza for the symlinked path too:

    <Directory "/var/www/yourdomain.tld/web">
    .....
     
  3. rob_morin

    rob_morin Member

    So this works for the that single ip but not for subnet??

    <Directory "/var/www/clients/client1/web4/web">
    Require all denied
    Require ip 192.168.2.0/24
    Require ip 173.176.131.191
    </Directory>

    <Directory "/var/www/staging2.domain.com/web">
    Require all denied
    Require ip 192.168.2.0/24
    Require ip 173.176.131.191
    </Directory>
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    It should work, but you may try:

    Require ip 192.168.2

    instead
     
  5. rob_morin

    rob_morin Member

    Tried that, it breaks apache when restarting...
     
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    What about this syntax?

    Require ip 192.168.2.0/255.255.255.0
     
  7. rob_morin

    rob_morin Member

    oh wait it does not break it, it just not work still
     
  8. rob_morin

    rob_morin Member

    192.168.2.0/255.255.255.0
    gives same result, does not allow it. Oddly enough if i just put one ip from subnet it does not work either??

    <Directory "/var/www/clients/client1/web4/web">
    Require all denied
    Require ip 192.168.2.75
    Require ip 173.176.131.191
    </Directory>

    <Directory "/var/www/staging2.domain.com/web">
    Require all denied
    Require ip 192.168.2.75
    Require ip 173.176.131.191
    </Directory>
     
  9. rob_morin

    rob_morin Member

    Ah mess! ok i am stupid nevermind.... I ma too embarrassed to say my dumb mistake
     
  10. rob_morin

    rob_morin Member

    I forgot i was internal but the server was external, i should have been putting my router public IP... stupid me, sorry to have wasted your time.
     

Share This Page