OPNsense Forum

English Forums => Web Proxy Filtering and Caching => Topic started by: myksto on November 30, 2017, 05:14:30 pm

Title: [SOLVED] Custom line of code in squid.conf
Post by: myksto on November 30, 2017, 05:14:30 pm
I would like to add some lines of code at the bottom of squid.conf (e.g. "error_directory /usr/local/etc/squid/errors/it" or some other acl).

Is there a way to do that? Unfortunately everytime I make a change through the gui the "apply" button delete all my custom lines.

Thanks a lot.
Title: Re: Custom line of code in squid.conf
Post by: franco on December 02, 2017, 03:42:44 pm
Hi myksto,

You can drop custom rules into the following directories, they are automatically included and not overwritten:

Code: [Select]
include /usr/local/etc/squid/pre-auth/*.conf
include /usr/local/etc/squid/auth/*.conf
include /usr/local/etc/squid/post-auth/*.conf

But please mention these in your bug reports as modifications can have side-effects.

If you, however, feel that a feature is missing or you would want to include it into the core templates, please open a ticket here:

https://github.com/opnsense/core/issues


Cheers,
Franco
Title: Re: Custom line of code in squid.conf
Post by: myksto on December 04, 2017, 08:32:19 am
I really thank you Franco, it works like a charm.
In my case the "post-auth" folder fits my needs by now.

Cheers, Michele.
Title: Re: Custom line of code in squid.conf
Post by: franco on December 04, 2017, 04:53:03 pm
Hi Michele,

Splendid, thanks for the follow-up. :)


Cheers,
Franco
Title: Re: [SOLVED] Custom line of code in squid.conf
Post by: tux.JCC on December 20, 2017, 09:32:29 pm
Hi Franco!

We did a simple SubTab that does it (screenshots attached).

If you want we can share the code with you.

Regards!
Title: Re: [SOLVED] Custom line of code in squid.conf
Post by: franco on December 21, 2017, 04:58:24 pm
It's not our favourite solution to enable custom file dumps, but if you open a PR on GitHub we can discuss it and optionally hide it under an advanced setting.

https://github.com/opnsense/core/pulls

I just did a similar thing for NTPd cause instead of raising tickets for features people keep asking for a custom block and we would rather add easy features for everyone that can be documented and improved.


Thank you,
Franco
Title: Re: [SOLVED] Custom line of code in squid.conf
Post by: fabian on December 21, 2017, 05:02:42 pm
We did a simple SubTab that does it (screenshots attached).

If you want we can share the code with you.

We know how to do that and there is a reason not to do it - It is dangerous for multiple reasons:
* It makes it easy to break the service (results in lots of questions and hard to debug).
* It allows remote code execution (Squid has lots of commands which allow execution of binaries on the system. You effectively allow a user who can do that shell access (probably without knowing that) and therefore it might be possible to compromise the machine.

Regards

Fabian
Title: Re: [SOLVED] Custom line of code in squid.conf
Post by: tux.JCC on December 21, 2017, 07:24:19 pm
@Franco, thank you! But I don't want to cause any annoying new thread with a new feature and break the project's  philosophy!

@Fabian, we' made a fork that runs only on our UTM appliances platform, so as a Managed Security Services Provider, who has the root/admin privileges on it is only our trained analysts, so we don't have so much reasons to not to do that, so we do it!  :)

In past, I've worked with BluecoatSG Proxies appliances and they have something they call CPL (Content Policy Language), maybe we can consider something similar, in this way an interpreter do the job of filtering what is danger to apply to daemons config files. Just an idea!  :D

Thank you!

Regards!
Title: Re: [SOLVED] Custom line of code in squid.conf
Post by: franco on December 24, 2017, 02:53:44 pm
Hi tux.JCC,

We have rules to build a flexible environment, that in part means we have to adapt rules from time to time. Starting a discussion, adding a disputed PR can both help change views and find other solutions, in the end a better way forward.

The best way is to take a tiny PR and see how that goes and move on from there, making larger code inclusions, etc. :)

So for "CPL" it's like a rules engine in the background and squid only pushes the user account and connection info?


Cheers,
Franco
Title: Re: [SOLVED] Custom line of code in squid.conf
Post by: allexBR on July 16, 2021, 07:21:20 pm
Hi guys,

I would like to know if anyone managed to solve the following problem...

In squid.conf, the ACL remote blacklists are evaluated before the "Auth plugins" include, which has the custom whitelists:

https://github.com/opnsense/plugins/issues/1111

Thanks!