pfSense UPS Widgets

APC BE550G UPSLast month I walked into my home office and heard the buzzing of a UPS. After switching it out with another smaller UPS, I wiped off the dust and found the model number on the bottom to be: BE550G. These older UPS models are no longer even supported by APC anymore. After doing a search online, I found BatteryPlus.com had a replacement battery and they have a store nearby. I ordered the Duracell Ultra 12V 9AH High Rate AGM SLA Battery with F2 Terminals [SLAHR12-9FR] and then picked it up the same day. After letting the battery charge overnight, I had to hook the UPS up to my Windows machine to set the Battery Date using the PowerChute software. For some reason this is not possible on other operating systems and open source software that I could find. Once I had this done, I moved the UPS over to my pfSense firewall and connected it directly to one of the USB ports on the firewall.

There are a couple of different packages for pfSense that you can install. pfSense is FreeBSD based, so you can install the software natively or use the pfSense packages to install. Once you configure the setup, the packages offer dashboard widgets that you can add to the pfSense dashboard. Here is what each one looks like.

Apcupsd

Developed for only APC UPS units, apcusd features a better looking widget.

pfSense Apcupsd dashboard widget

Network UPS Tools

Known as the NUT package, this open source software has a more simplistic dashboard, however Network UPS Tools supports more devices and has extensive features for UPS units directly connected or on the network.

pfSense UPS dashboard widget

Additional Notes

Setting up either package requires reading the setup documentation online. I was able to run both packages for a direct USB connected device.

For apcupsd set UPS Cable and UPS Type to “USB” and leave the Device field blank. If you are using NUT, set the UPS Type to Local USB and driver to usbhid.

Overall I am glad that I could salvage the UPS and keep it in service. This keeps perfectly good equipment working and prevents waste. The plus, is that my firewall and internet connection will run a bit longer and not reset during a power spike.

pfSense 2.4.5 Package Manager Defect

There is a defect with pfSense 2.4.5 and the Package Manager. When installing, upgrading, or removing packages, the process will not complete. For the Squid package, I did the following to upgrade:

  1. Stop the Squid service
  2. Attempt to upgrade the Squid package
  3. Wait until the process stalls
  4. Use Putty to SSH into the pfSense firewall
  5. Select the SSH option
  6. Execute the command to kill the Package Manager and then Exit
killall -9 pkg-static

Reference the following forum post on the Netgate pfSense forum for more info.

pfSense Dynamic DNS

pfSense FirewallWorking remotely is pretty common these days, and even if you take your iPad with you, you always end up needing to access something on your local computer. For this, I have a Windows Server to which I connect to via Microsoft Remote Desktop. This works out great and allows me to access files, or use applications on my Windows box, that are not installed on say my iPad or my MacBook. However in order to get to my home machine, I need to have an external address on the internet. For this I have my own domain name which I have had for a few years now. The other issue I have is that my home internet connection does not have a static external IP address and so the IP address changes from time to time. Even though I have a domain name, I need a way for the domain name records to update every time the IP address changes on my DSL modem. This is what Dynamic DNS was invented for: updating DNS records as needed with new IP addresses. If you have your own domain name, you usually have to pay a provider to host your DNS and they will provide some sort of software or script that will update your DNS. This posting details how I setup pfSense to update my DNS provider ChangeIP.

Add Dynamic DNS to pfSense

First log into your pfSense admin panel and choose Services – Dynamic DNS. Under the DynDNS tab click on the cross icon to add an entry. You will come to a screen like this one:

pfSense Firewall DDNS

  • Change Service type to Custom
  • Check the Enable verbose logging option
  • Add your Update URL
  • Add a description
  • Click Save

Update URL

The URL needs to be specific to your setup at ChangeIP. In my case, I have one domain with the three basic DNS A records: domain-name.net, www.domain-name.net, and ftp.domain-name.net

Here is an example of the URL:

https://nic.ChangeIP.com/nic/update?u=username&p=password&set=1&ip=%IP%

In order to update all my dns records, I have setup domain-name.net, www.domain-name.net, and ftp.domain-name.net to be in set 1 at ChangeIP. The SET= parameter tells ChangeIP to update records in set 1 to the IP specified. The %IP% is a the variable pfSense uses to input the IP address it resolves for the WAN interface. Reference ChangeIP DDNS API Information for parameters and Setting Sets for DDNS Update.

Adding Cronjob for DDNS

With the Cron package installed, it is easy to add and modify Cron jobs. What I recommend doing is scheduling a Cron job to run every ten minutes.

pfSense Firewall Cron DDNS

Checking System Log

Once you force the update, it is important to check to see if it worked. You can check the System Log in pfSense to see if there were any problems that occurred and then at ChangeIP, check your Domain Manager – Premium Domains – Domain-Name – A records, to see if all records in Set 1 updated to the same IP address.

Mac OS X 10.9 Mavericks SMB2 and Windows 2012 Essentials Server

Apple LogoApple has a long history with computer networking, from AppleTalk to today’s Internet connected world. However, it is Windows networking that still causes all kinds of headaches for Mac OS X users. It seems that with every release of Mac OS X, Apple seems to have recurring issues with Windows shares. Some of Apple’s defenders will state that Apple adopts industry standards as is, and it is Microsoft and others who publish specs, but don’t actually follow them, so when Apple does follow the specs, it seems to just end up breaking things. SMB is the networking protocol that Microsoft uses for Windows networking. It is what allows Windows network file shares to work across the network. With the latest versions of Mac OS X, Apple abandoned the open source SAMBA package that most Linux distros use to connect to Windows, and wrote their own SMB2 software. This makes Mac OS X 10.9 Mavericks connect faster and better to Windows servers. Well that is when it works!

SMB Connections Fail

There is one Windows 2012 Essentials server with multiple shares. There are two Macs on the local network. One iMac is connected over Wireless N and one MacBook Pro is using a wired ethernet 1Gb connection. When using the Connect to Server… option the iMac connects fine and has no issues. The MacBook Pro opens the share and then never displays any files, it just spins in the lower left hand corner of the window that opens. Both computers are running Mac OS X 10.9.3 Mavericks.

Mac OS X SMB Connect to Server

Connecting via CIFS instead of SMB seems to work for the MacBook, but it is slower.

The Solution

The solution ended up modifying the Windows 2012 Essentials server. There are two registry keys that need to be added in order to fix the problem for the MacBook.

Under this Registry Key:

  • HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters

Add these DWORD values:

  • Smb2CreditsMin – make this 768
  • Smb2CreditsMax – make this 16384

Once you made the changes restart the Windows Server and then the Macintosh clients. It should now fix the problem.

Microsoft provides the following information on these registry keys:

The defaults are 512 and 8192, respectively. These parameters allow the server to throttle client operation concurrency dynamically within the specified boundaries. Some clients might achieve increased throughput with higher concurrency limits, for example, copying files over high-bandwidth, high-latency links.

Fix SARG Reports in pfsense

torchSARG Reports are a good compliment to Squid Proxy and since there is a package that is available for installation in pfsense, it makes good sense to setup SARG Reports. The downsides to SARG Reports is that the reports do take up space and over time this can be significant. This posting is about a problem I encountered on pfsense 2.1 and the latest SARG package.

For some unknown reason the reports stopped generating. Upon checking my System Log this is the issue I found:

php: /pkg_edit.php: The command 'export LC_ALL=C && /usr/pbi/sarg-amd64/bin/sarg -d `date +%d/%m/%Y`-`date +%d/%m/%Y`' returned exit code '1', 
the output was 'SARG: Cannot get the modification time of input log file /var/log/squid/access.log (No such file or directory). Processing it anyway SARG: File not found: /var/log/squid/access.log'

I am using the 64-bit version of pfsense, so hence the sarg-amd64. If you are using 32-bit, it will state instead sarg-i386.

The solution is to edit the sarg.conf file that is located in one of these locations, depending on your pfsense build:

/usr/pbi/sarg-amd64/etc/sarg/sarg.conf
/usr/pbi/sarg-i386/etc/sarg/sarg.conf

You will need to verify that the access_log line is correct:

#access_log /usr/local/squid/var/logs/access.log

In my case, removing the # sign and specifying the correct path to my Squid access.log corrected the problem.

If you have issues with SARG Reports, it is best to do the following:

  1. Under the Status Menu – click SARG Reports.
  2. On the General tab click Save
  3. Next click on the Users tab and click Save
  4. Click Schedule and create your schedule or if you have one already open it up and click Save.
  5. You can go back to the Schedule and Force Update to see if SARG Reports are working now.

I also schedule SARG Reports in Cron to run at 11:50pm every night instead of midnight.

50  23  */1  *  *

Zoho Email For Domains Setup

Zoho EmailIn this post, I discuss how to setup your own domain with Zoho Mail, a hosted email solution from Zoho. Similar to Google Apps, Zoho provides a set of online business tools including office apps, project management, and contact management. At the time of this post the hosted email package has a free option as well as higher tiers for users who need more options. The biggest selling point for Zoho is that none of their apps have advertisements, and so if you are bothered by other webmail solutions that feature ads, Zoho seems to be a good alternative solution. Other than webmail access, the other reasons to use Zoho is that it works with desktop email clients, smartphones, and tablets.

My Requirements For An Email Solution

In order of importance, here is what I was looking for in an email solution.

Integrates with your Domain name

  • I wanted an email solution that would work with my current personal domain that my family uses.

iPhone and iPad Support

  • Everyone in the family has an iPhone, iPod, or iPad that they can use for email.

Apple Mail Support

  • Oh, we do use our Mac computers every now and then, so we need desktop mail.

IMAP

  • I want to keep email on the server, and not worry about losing it. I can also manage my email from my smartphone when I have time. This is really convenient.

Cost

  • Free if possible, but am willing to pay for a good solution on a yearly basis.

Ad-free

  • Not having my kids bombarded with advertisements is a good thing.

Zoho’s Instructions

Step 1: Verify domain ownership
Please verify your domain ownership. This is required to prevent imposters from using domains to send malicious messages. You can follow either the CNAME method or HTML method for verification.

Step 2: Add / import users to your organization
As the administrator of your organization, you have a Control Panel link in your user interface. In the Control panel, click User Details on the left list of options and click Add User option on the top. You can also import a list of users by selecting the Import User option.

Step 3: Migrating data to Zoho Mail
We recommend you to test migration for 2 users before pointing MX records.

Step 4: Point MX records to Zoho
Point the Mail Exchanger (MX) records to Zoho to start receiving mails to your inbox.

Changing My eMail

Steps 1 and 2 were pretty easy. Since I only have 4 users accounts, it took a few minutes to setup my four users in the Control panel. I skipped Step 3, I don’t really keep a lot of personal email. My current email was stored in Apple Mail and I was fine leaving it there. The interesting step is number 4. The Internet works via DNS. The domain naming system allows everyone and everything to find each other on the network. This is accomplished by DNS having different types of records to point requests to the right place. In the case of most personal domains, you have two different parties involved. The first is a domain registrar who takes care of your domain registration. The second is your hosting provider, usually for shared hosting this is a cPanel type hosting provider. When someone tries to email you at user@some_domain_name.net, a lookup is made to the root DNS authority for the .net domains, your registrar is what adds your domain to the DNS authority servers. The root server then sends you to your nameservers specified. Your nameservers are at your cPanel hosting provider. The final step in the lookup is to see what your cPanel nameserver has for what is called the MX records. The MX records have the server that processes your email and ideally where the email is going to go.

Zoho Email For Domains

Your current hosting provider has MX records for its own email processing. What needs to be done, is to remove the current MX records and replace them with MX records that point to Zoho’s servers. This way only your email, emails sent to user@some_domain_name.net, will route to Zoho, but everything else will still be at your current hosting provider. To do this most cPanel hosts make it easy to do this now. Log into your cPanel control panel and scroll down to the Email section. You want to click open the MX Entry icon.

cPanel Email MX Entry

You will first choose your domain name that you want to change the MX records for. This is your main domain. First add the MX entries as Zoho instructs, then remove your current record for your host. When the changes are complete, it should look similar to this:

Zoho MX Records

The DNS changes take a matter of minutes to a couple of hours to propagate to the rest of the internet.