Adding X-Forwarded-For header logging on Apache for ISPConfig3

If you’re running your Apache with ISPConfig3 behind a reverse proxy or load balancer, you’ll probably want to log the X-Forwarded-For header, set by your reverse proxy/load balancer. If your setup sets a custom header, no worries, the method is the same.

The LogFormat format for ISPConfig3 with Apache is stored in /etc/apache2/sites-available/ispconfig.conf, the line looks like this:

LogFormat “%v %h %l %u %t \”%r\” %>s %O \”%{Referer}i\” \”%{User-Agent}i\”” combined_ispconfig

To add logging for the X-Forwarded-For header, simply add

%{X-Forwarded-For}i

anywhere you’d like the users actual IP to be logged. Here’s what mine looks like:

LogFormat “%v %h %{X-Forwarded-For}i %l %u %t \”%r\” %>s %O \”%{Referer}i\” \”%{User-Agent}i\”” combined_ispconfig

Windows: Map network drive to a folder

The default behavior of mapping a network drive does exactly what it sounds like it does: it maps a network share to a local drive. Sometimes, you may want to map a network share to a folder, or subfolder, on your local system. This can be done pretty easily.

Open up a command prompt, as Administrator, and type the following:

mklink /d “c:\path\to\local\folder” “\\path\to\network\share”

Replace “c:\path\to\local\folder” with the path on the local drive where you’d like the network share to be mounted, and replace “\\path\to\network\share” with the actual path to the network share.

If you already have the credentials for this network share saved, or it’s a public share, you’re all set. Otherwise, you’ll be prompted for credentials. You can save these the same as you would save them when you map a network drive the normal way.

This can work very well in conjunction with mapping multiple shares on a target machine with different accounts.

Windows: Mount multiple samba shares from the same host, using different credentials per share

By default, Windows will only allow you to mount one share per destination computer at a time. For example, if you’re working on a Windows computer, and have a file server running samba with multiple users, you may run in to this issue.

One way around this limitation is to create additional DNS entries (either on a local DNS machine or in the host file of the Windows machine) per share.

Let’s assume your Samba server has three different shares, each owned by a different user: Share1, owned by User1; Share2, owned by User2; Share3, owned by User3. For this example, the IP address of the Samba server is 192.168.1.100.

If you are running a local DNS server, you can simply add additional records pointing to the Samba server. If the local domain name of the Samba server is samba.lan, you could add records such as share1.samba.lan, share2.samba.lan, and share3.samba.lan. Then, on the Windows machine, attempt to access Share1 by the following address in file explorer:

\\share1.samba.lan\shareName

Windows will prompt you for credentials. Enter the credentials for User1. Repeat for Share2/User2, and Share3/User3.

If you do not have a locally running DNS server, you can still use this same method. Open up Notepad, running as Administrator, and open up the host file (C:\Windows\System32\drivers\etc\hosts). Add entries similar to the following:

192.168.1.100     share1.samba.lan
192.168.1.100     share2.samba.lan
192.168.1.100     share3.samba.lan

and save the file. That will achieve the same results as adding records to a local DNS server, but only for the local computer. Once you’ve made these changes, open up file explorer, enter \\share1.samba.lan\shareName in the address bar, and enter the credentials for User1.

Pretty simple!