Installing the Dansguardian package in PFSense - One user's experience
-
I did get the Dansguardian to work if I manually set the proxy, but I've added the rules to FW without any luck.
I've put the rule
Proto: TCP
Source: LAN net
Port: *
Destination: 192.168.1.1
Port: 8080
above the lan-any rule, so it should work but it does not?
How to solve?
I can provide screenshots if asked. -
Your nat is not correct, pay attention on nat description from the first post and apply on your config.
-
Your nat is not correct, pay attention on nat description from the first post and apply on your config.
I've done that,
First is NATEdit: I totally forgot that I'm connecting via VPN on my client, my bad.
Thanks for a great "user experience" -
I've only just had a chance to come back to see if there were any replies and this is a pleasant surprise. I'm delighted it's helped people.
-
thanks guys this really helped me out alot.
I have a question, what if I want to add in squidguard to control access at times of day. Say 9am til 5pm only, on certain machines with a certain IP address.
Had a bit of a try and I seem to be able to get on the net anytime with the config I tried.
Anyone tried this??
Thanks
Chris -
You mean dansguardian,squid and squidguard? ???
-
Yeah, can you not use squidguard as well?
Or can I just put some settings into danguardian to control time of day access?
Thanks
(by the way marcelloc, good work!!)
-
I'm going to make a suggestion Chris but I've not tried this solution, it's speculative, so feel free to shoot me down if I missed something.
Firewall>Schedule is possibly what you're looking for to solve the problem. If you only want content filtering between 9 - 5 then apply the schedule to the redirect rule such that DG and Squid are bypassed outside of the access hours. If you don't want any access at all outside of those hours then you can construct a rule that blocks certain IP and is only activate outside of those hours.
Hope that helps
-
aagghhh,
genius. Why did I not think of that. So simple really, it passed me by….
Thanks a lot Chewy
-
Update - I don't seem to be able to edit the original post which I can see makes some sense for integrity reasons so I'll add some updates here (these aren't necessarily requests for change just observations for fellow travellers).
Refreshing Dansguardian when changes have been made seems to be a bit hit or miss. The only entirely reliable method I've found is that suggested by Zgruk from the command line issue "dansguardian -Q". The "save" buttons work sometimes but not others which I suspect is entirely to do with DG and not the packaging.
Rebooting the PFsense box caused me some odd problems. DG started before Squid and doesn't seem to keep trying to establish a socket with Squid, hence, any requests to DG fell into a black hole including the access to PFsense to fix the problem. Because of my (insecure) set up I could manually direct the browser at Squid to access PFsense, refresh DG using a simple save and that seemed to establish the socket between DG and Squid giving me back normal access.
If you're not as insecure as me (and I don't recommend it for any professional set up) then the way to get back access would be to use the command line refresh I mentioned above.
There may be a way to force squid to come up before DG I'm not sure. I'm more of a Linux man than BSD and despite their shared heritage they're different enough for me to have to research that change. If there's anyone out there who can supply the answer I'd be really grateful.
-
Rebooting the PFsense box caused me some odd problems. DG started before Squid and doesn't seem to keep trying to establish a socket with Squid
Exactly the same issue here too.
I normally have to cycle the DG service after bootup.Not sure quite what's happening here.
-
Rebooting the PFsense box caused me some odd problems. DG started before Squid and doesn't seem to keep trying to establish a socket with Squid
Exactly the same issue here too.
I normally have to cycle the DG service after bootup.Not sure quite what's happening here.
Can you check these steps posted on dansguardian topic at packages?
http://forum.pfsense.org/index.php/topic,43786.msg253812.html#msg253812 -
Checked the thread and this appears to be the same problem as reported by Cino :
I think the problem I have, dansguardian is starting before squid.
We've had a long weekend in the UK so I did some checking into how the start up tasks are set in BSD. Forgive me if I'm telling you things you already know but it seems BSD uses directives (e.g #PROVIDES) within the start up jobs to create a dependency order. The directives show what a daemon provides and requires, which in turn are used by rcorder to order the job starts.
Marcello uses the directives in the Dansguardian start up job but squid doesn't use them which results in a random start order at best. The way to fix this would be to use the native BSD system consistently but it seems that historically this hasn't been done. I can imagine a work around which alters the "squid.inc" file to copy a template start up script in the same way that Marcello does it and in this squid template include the standard directives hence dictating the start up sequence.
The other idea I had was to check for squid.sh in /usr/local/etc/rc.d and if it exists start it in the Dansguardian script. Something like this before the code to start DG:
if [-e /usr/local/etc/rc.d/squid.sh]; then /usr/local/etc/rc.d/squid.sh echo "#! /bin/sh" > /usr/local/etc/rc.d/squid.sh fi
As I mentioned previously, I'm no expert with BSD so if I've got this wrong please do correct me (as much for my education as others).
-
Thanks Chewy, I'll do some tests and feedback.
-
yeah, the message I get on reboot is:
Dansguardian no process found
Dansguardian no process found
Dansguardian no process foundI just start or restart it once boot is complete and all is OK.
No biggee, but slightly annoying.Thanks and wouldn't be without it….
-
I've tested it today on a clean install and dansguardian did worked after reboot.
It still takes 1minute to start but it works. ???
-
Curious to me that it worked for you… I had the same problem - DG wasn't working because it started before Squid. I couldn't figure out how the package manager controlled the order of startup scripts, so I did a little hack. I simply created another startup script called z_fixstartup.sh and placed it in /usr/local/etc/rc.d. Contents of the script is...
#!/bin/sh
This file was automatically generated
by the pfSense service handler.
rc_start() {
/usr/local/sbin/dansguardian -Q
}rc_stop() {
}case $1 in
start)
rc_start
;;
stop)
rc_stop
;;
restart)
rc_stop
rc_start
;;
esacI had another small issue that someone else might want to be aware of. If you create a NAT rule to autoforward port 80 traffic, this somehow breaks XBox downloads. I had to exclude the IP address of the XBox in the forwarding rule.
-
RJ - Nice fix I'm going to try that one. What I still don't understand though is, as you say, how does the package manager control the start up order ? Is there no consideration to the order designed in to the mechanism ?
Marcello - I don't get it and I'm wonder if it's somehow random ? Does DG sometimes start after Squid or does it sometimes retry the connection, I have no idea, but it's very frustrating particularly when we can't reliably recreate the problem. Your comment about the time taken makes me wonder if I wait longer would the connection between DG and Squid eventually start ?
-
I don't get it and I'm wonder if it's somehow random ? Does DG sometimes start after Squid or does it sometimes retry the connection, I have no idea, but it's very frustrating particularly when we can't reliably recreate the problem. Your comment about the time taken makes me wonder if I wait longer would the connection between DG and Squid eventually start ?
If you check boot-up process, you will see dansguardian taking about a minute to startup. Did you tried to wait boot process finish before trying to connect to dansguardian?
-
I'll move the startup script somewhere else and try it again… but I'm fairly certain that it was never coming up - or at least not consistently.
This one might be a little off topic, but let me throw out another "feature" idea from something that I originally had working on my IPCop box. I had IPCop running with DG/Squid by using the copplus addon. In addition, found a script that got me started and then made some changes to implement a "Dansguardian Bypass" that would allow you to enter a password and bypass filtering for a time period. It's nice because sometimes DG is overly aggressive in filtering. I don't remember where I got the setup script, but on IPCop it was doing perl CGI to a web server on port 81. It also looks like someone did the same thing with PHP on ClearOS (see http://honestpchelp.com/2011/clearos-dansguardian-accessdenied-php-bypass-script/).
I'm going to play around trying to get it to work on PFSense. However, the forum instructions I found for setting up a web server required installing a couple packages and mysql (see http://forum.pfsense.org/index.php/topic,47086.msg247364.html#msg247364)… it just seemed a little excessive to me since there's already a web server running for the web interface. Is there an easy way to get a web server instance that supports perl CGI or PHP on another port? Or... better yet, has anyone already implemented the bypass feature?