First of all, ICAPrb::Server is ONLY an ICAP server. If you want it to do useful stuff, you will need to develop your own module. This requires some Ruby knowlege.

First of all, you will need an installation of OPNsense. You can download it from one of the mirrors. If you already have it running, you should consider to install updates.

When you have an up to date version of OPNsense, you will need to install Ruby. This is easy because you only have to enter the following command on your shell:

pkg install ruby

To be able to edit files you will also need an editor. If you have not already installed one, I prefer vim, which can be installed like above:

pkg install vim-lite

The next step is that you will need to install the command gem. Because it is not available in the OPNsense repositories, you will have to temporary enable the FreeBSD repositories. Note, that FreeBSD-Packages can break your system and you should not update any software which is updated via the OPNsense repositories. It should not be an issue on some scripting libraries but with compiled applications and libraries this could lead to broken software, because the different versions of the library are not compatible or different patches are used. To enable it, you will have to edit /usr/local/etc/pkg/repos/FreeBSD.conf. You only need to change the no to yes.

After this change is done, you can install applications from the FreeBSD repositories as well so you can install gem now:

pkg install ruby22-gems

Note that Ruby23 stands for Ruby with the version 2.3. You are almost done. Just execute

gem install icaprb-server

and your ICAP server is ready for being used. Note that you can install additional libraries now from the FreeBSD packages if you need them because you should disable the repository again to make sure any update of OPNsense will not break the system. The gem tool can be used regardless of if the FreeBSD repository is enabled.

To run the server, you will need a script which will load the server library and runs the server. For example, you can use the script I provide here.

Because you probably want to use your ICAP server with your web proxy, you probably want to configure it in the GUI. For doing this, you need to open a web browser and navigate to your firewall interface. The proxy configuration is in the "Services" menu. If you open the configuration page of the proxy, the ICAP settings use their own sub tab of the forward proxy. You need to enter the two urls and check to enable the proxy. When you are finished, click save. Note that your ICAP server must be reachable by the proxy or it will deny to send requests to the internet. The URLs in ICAPrb::Server could look like this


The service name is the string you used in the services hash.