LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 06-12-2018, 09:21 AM   #1
jimbolaya
LQ Newbie
 
Registered: Oct 2013
Posts: 16

Rep: Reputation: Disabled
Help with restricting access to ProxyPass proxy host.


I am attempting to use LetsEncrypt with my home-rolled FreePBX instance so I can use TLS transport. In order for LetsEncrypt to work with FreePBX, I need to allow access to a list of hostnames to port 80 on my FreePBX instance. But I don't want to give the world access to my FreePBX admin interface.

The FreePBX server is behind my NATed router so I was hoping to use ProxyPass to forward the traffic using my existing Apache instance.

I would like to add a config like this:

Code:
<VirtualHost *:80>
    ServerName freepbx.mydomain.org
    Require forward-dns outbound1.letsencrypt.org outbound2.letsencrypt.org mirror1.freepbx.org mirror2.freepbx.org
    ProxyPass /    http://192.168.168.183
    ProxyPassReverse   /  http://192.168.168.183
</VirtualHost>
I've got other proxys set up on my server, so I have some idea how to set them up. But any time I try to add a Require or Allow directive it says

Code:
Jun 12 09:59:13 myserver apache2[1718]: <RequireAll not allowed here
or

Code:
Jun 12 09:38:12 myserver apache2[26767]: order not allowed here
The documentation states:

Code:
The directive can be referenced within a <Directory>, <Files>, 
or <Location> section as well as .htaccess files to control access 
to particular parts of the server.
So, clearly this isn't an option for a VirtualHost section. I'm not finding any other information restricting access to a VirtualHost.

I am hoping someone has an idea on how to set this up.
 
Old 06-12-2018, 01:55 PM   #2
jimbolaya
LQ Newbie
 
Registered: Oct 2013
Posts: 16

Original Poster
Rep: Reputation: Disabled
Partially Solved

I got the LetsEncrypt stuff to work with my FreePBX:

Code:
<VirtualHost *:80>
    ServerName freepbx.myserver.org
    ServerAlias freepbx.myserver.org

    # keep the host
    ProxyPreserveHost On

    ProxyPass /.freepbx-known/    http://192.168.168.183/.freepbx-known/
    ProxyPassReverse   /.freepbx-known/  http://192.168.168.183/.freepbx-known/
    ProxyPass /.well-known/    http://192.168.168.183/.well-known/
    ProxyPassReverse   /.well-known/  http://192.168.168.183/.well-known/
</VirtualHost>
However, I haven't gotten restricting source hosts to work right yet.

I read somewhere to try something like this:

Code:
<Directory proxy:>
     Require host outbound1.letsencrypt.org outbound2.letsencrypt.org mirror1.freepbx.org mirror2.freepbx.org
</Directory>
But whether it's there or not seems to make no difference.
 
Old 06-12-2018, 03:08 PM   #3
jimbolaya
LQ Newbie
 
Registered: Oct 2013
Posts: 16

Original Poster
Rep: Reputation: Disabled
Completely Solved

Here's my final setup. It denies access to the base domainname, freepbx.mydomain.org, but allows access to my "Require" list to those subdirectories.

Thank you to "thumb" on IRC for some guidance.

I added "another.test.host.com" that I could try to make sure I could get to it from for testing purposes.

Code:
<VirtualHost *:80>
    ServerName freepbx.mydomain.org
    ServerAlias freepbx.mydomain.org

    <Location "/">
          Require all denied
    </Location>

    # keep the host
    ProxyPreserveHost On

    <Location "/.freepbx-known/">
         Require host outbound1.letsencrypt.org outbound2.letsencrypt.org mirror1.freepbx.org mirror2.freepbx.org another.test.host.com
         ProxyPass  http://192.168.168.183/.freepbx-known/
         ProxyPassReverse   http://192.168.168.183/.freepbx-known/
    </Location>
    <Location "/.well-known/">
         Require host outbound1.letsencrypt.org outbound2.letsencrypt.org mirror1.freepbx.org mirror2.freepbx.org another.test.host.com
        ProxyPass   http://192.168.168.183/.well-known/
        ProxyPassReverse  http://192.168.168.183/.well-known/
    </Location>
</VirtualHost>
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Squid Proxy(centos):How to configure internet access for a specific IP address to access only YouTube on squid proxy raymond m Linux - Newbie 3 07-26-2017 03:05 PM
Squid proxy cannot access host via IPV6. . . Rory_L Linux - Newbie 8 03-27-2012 05:20 PM
Restricting Daemons to Local Host ganz_friedrich Linux - Newbie 10 01-20-2006 05:31 AM
Restricting bandwidth using proxy mercunium Linux - Networking 0 03-03-2004 03:11 PM
access a win-proxy with a linux host rafaelspotto Linux - Networking 0 07-30-2003 10:35 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 04:30 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration