Quantcast
Channel: The SharePoint Farm
Viewing all articles
Browse latest Browse all 184

SharePoint with Apache mod_proxy

0
0

The Apache Software Foundation provides a reverse proxy module named mod_proxy and mod_ssl (which extends functionality into SSL). This is a non-authenticating reverse proxy similar to function to Microsoft’s IIS Application Request Routing module. This article will cover getting a single Web Application on a single SharePoint server behind the reverse proxy over SSL on port TCP/443. We will be starting from the same VM as used in the previous blog post about using CentOS and iptables, so familiarize yourself with that before continuing as that will be the base configuration moving forward. By now I will assume that you’re familiar enough with vi to know how to save files. In addition, I will assume that the Domain Controller on the Hyper-V Internal vSwitch is at 192.168.0.2 and the SharePoint server is at 192.168.0.3. In addition, our SharePoint server is going to have an SSL certificate of sharepoint.corp.nauplius.net, and of course that is what our Web Application will be. This particular SSL certificate has been issued from StartSSL (it’s free). The first step will be to modify the networking on the CentOS virtual machine. [crayon-53aa109c8419a986885131/] Add a new line: [crayon-53aa109c841c5502302359/] This will disable the DHCP client ([crayon-53aa109c841dd338865141-i/]) from automatically adding the DHCP servers DNS information to [crayon-53aa109c841f2518332192-i/] (which is what allows the VM to automatically resolve domain names). Instead, we’re going to manage that using the internal Domain Controller over [crayon-53aa109c84207703817120-i/]! [crayon-53aa109c8421c265714289/] Add a new line: [crayon-53aa109c84231688959501/] Next, let’s edit the resolv.conf [crayon-53aa109c84246884038909/] Change it so it reads: [crayon-53aa109c8425b673316952/] The next step is to bring up and down both interfaces. [crayon-53aa109c8426f566236463/] Once both interfaces are back up, your Windows Servers should continue to have name resolution connectivity to the Internet. In addition, [crayon-53aa109c84284192129044-i/] should show the static settings you inputted ([crayon-53aa109c84299491107094-i/]). In addition, you should be able to ping, from the CentOS VM, to the internal servers by IP and FQDN. Next, we need to install a few packages on CentOS. Apache (for [crayon-53aa109c842ae708278815-i/]), [crayon-53aa109c842c2450609273-i/] (for SSL support), and [crayon-53aa109c842d7482936443-i/] (for [crayon-53aa109c842eb215355419-i/], similar to [crayon-53aa109c84300126018806-i/] on Windows). [crayon-53aa109c84314690541722/] We now need to add a couple of new firewall rules: [crayon-53aa109c84329508786623/] And save the rules: [crayon-53aa109c8433e838669237/] This allows iptables to accept SSL traffic to the reverse proxy (locally). The next section will not be quite as easy. We will be dealing with SSL certificates on the CentOS VM. In order to do this properly, we’ll need to upload certificates to the CentOS VM and unlike Windows, it isn’t quite the point-and-click affair with PFX. Most SSL certificate vendors will offer an unencrypted private key as well as public key file. You’ll want both of these. In addition, you’ll also want the appropriate Certificate Authority SSL certificate bundle (this contains the public certificate chain for your SSL certificate). If your SSL vendor does not offer these file types, you’ll need to use OpenSSL to convert the files to the appropriate file formats. For reference, here will be my file names: Unencrypted private key: sharepoint.key Public key: sharepoint.cer CA bundle: startssl-bundle.pem In addition to this, specifically for mod_ssl, we will need a single file that contains both the public and unencrypted private key in a single file. It should be in the following format: [crayon-53aa109c84357247904768/] You can use a program like Notepad++ to edit the sharepoint.key and sharepoint.cer files to create the new files with the public and private key contained within it. This will be the Public-Private key bundle, and saved as sharepointpubpriv.crt. Now all of these files need to be transferred to the CentOS VM. In order to do this, we’ll use a protocol called SCP. This protocol allows you to transfer files over SSH. Thanks to our default iptables rules, SSH is already open on our eth0 interface! Grab a copy of WinSCP and copy these files over to a directory (e.g. [crayon-53aa109c84370924298387-i/]). The next step is to copy over the files to the appropriate default locations. [crayon-53aa109c84385653809564/] Now, using [crayon-53aa109c8439b823282481-i/], we need to configure [crayon-53aa109c843af447269364-i/] (the primary Apache configuration file). [crayon-53aa109c843c4651077690/] Make sure the following lines exist: [crayon-53aa109c843d9983627511/] In my example, I’ve removed the [crayon-53aa109c843ee308393675-i/] as well as the default [crayon-53aa109c84402187751005-i/]. This is a reverse proxy intended to only listen on 443 and serve requests to our internal SharePoint server. There are many other settings within here that you can modify and likely should modify, but this is not an in depth lesson on Apache security. The next step is to modify the [crayon-53aa109c84418135192605-i/] file. [crayon-53aa109c8442c081764481/] [crayon-53aa109c84441591478131-i/] should be present at the top of this configuration file. Instead of providing you specific lines to set, here is the entire configuration. Again we’re using my example domain here, so adjust to fit your needs. [crayon-53aa109c84457876693197/] Make sure at the end of the [crayon-53aa109c84471575969612-i/] and [crayon-53aa109c84487169196743-i/] lines you end them with a “/” at the end of the path, otherwise relative paths will not be returned properly to the reverse proxy and you’ll see unexpected results. Once the changes are configured, run [crayon-53aa109c8449c784302891/] Any errors will be logged in the log files at [crayon-53aa109c844b0585159275-i/] and [crayon-53aa109c844c5771274274-i/]. To watch [crayon-53aa109c84503081821951-i/]  in real time, run: [crayon-53aa109c84518836538040/] The last step would be to edit the hosts file on any client computer to target, in this case, sharepoint.corp.nauplius.net at the IP of the [crayon-53aa109c8452d913623370-i/] interface. If everything goes well, we should be prompted for credentials and let right through to the SharePoint site!

The post SharePoint with Apache mod_proxy appeared first on Nauplius.


Viewing all articles
Browse latest Browse all 184

Latest Images

Trending Articles





Latest Images