Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - Govo

Pages: [1] 2 3 ... 11
Hi All
I started a little project for DansGuardian back several weeks ago to allow editing of configuration files such banned site list, exception ip list, etc.

I am looking for some testers and suggestion from the community.

The basic functions of the module is to allow editing of the configuration files without having to SSH into Linuxmce console.

The layout of the module is as followed.

A new folder called dansguardian is created inside the lmce-admin folder.

Inside of this folder contains several PHP scripts folders & two .sh files and one exported mysql  file.

On the initial setup the main index.php file checks the database to see if we have a database called dansgaurdian, If the database doesn’t exist, it will create it, and then import the exported mysql file.

Next, it checks to see if there is any IP address belonging to the MD’s in the pluto_main/ Device table and if there is any IP address, then export and import them into dansguardian/ exceptioniplist.

This check allows our entire MD’S to have full access to the internet.

The android app is just a font end to the module and allows you to easy  add and edit blocked/exceptional  ips and websites,  also  any changes made to the scripts in the back end, the app is updated on the next re-opening.

If you’re interested in testing or have any suggestion then follow the below.

You a can also see screen shots and video clips here

**Please note, I can't be held responsible if this back your system**.

I have  tested this on my live machine of 10.4 and it should work with 8 & 12 system, but I haven't tested it on 8.10 system.

Sudo commands maybe different on different systems.

To get started follow these instructions.
*** You must have DansGuardian & Squid3(transparent)installed first ***

Before we start, lets create a back up
SSH into your LMCE
mkdir /etc/dansguardianBACKUP
cp -r /etc/dansguardian/* /etc/dansguardianBACKUP
Check to see  if the backup is OK
cd /etc/dansguardianBACKUP
type dir  you should the files and folder then
continue to install below

1.   SSH into your LMCE
2.   chown your username -R /var/www/lmce-admin
3.   cd /var/www/lmce-admin/
4.   wget
5.   tar -xzf dansguardian.tar
6.   Check to see if the folder was extracted and created type dir
7.   you will see a folder called dansguardian in the lmce-admin folder.
8.   Type cd
9.   To ensure the folder and files is writable type
10.   chown your username -R /var/www/lmce-admin/dansguardian/
11.   type cd
12.   The Below command copies the scripts to enable and disable filtering
13.   cp /var/www/lmce-admin/dansguardian/setupfiles/*.sh /usr/pluto/bin/
14.   visit OR  http://dcerouter/lmce-admin/dansguardian/
15.   You should get all systems good to go if the install went correctly
16.   Download the android app from here

Warning Note:
if you are testing the filter by categories do not enable the categories that have a red warning.

If you have installed the blacklist correctly you will have a green tick against the each category.
This green tick tells you are good to enable.

If you enable a red warning dansguardian won't restart  and all internet will be down and you will have to edit the file manually and then  remove the all of the categories that were  enabled.

I use nano you may be using VI

nano /etc/dansguardian/lists/bannedsitelist

scroll down to the to the categories list  and crtl + k to cut the text  (ie nano) crtl + o to save and crtl+x to exit

restart Dans
/etc/init.d/dansguardian start or /etc/init.d/dansguardian reload

Then revisit filter by categories in the drop down menu. disable all and update Dans Guardian, other wise every time you update the file, it will hang the system because the database was not told to disable the category, and you will have to repeat the above steps.

You can see it in action by disabling the filter  and watching the log using this command  tail -f /var/log/squid3/access.log

Once disabled the log does not move or update.

any issues let me know in real time or in this topic.


Developers / Re: PHP to execute sudo command (CLOSED) NEW TOPIC OPEN
« on: October 08, 2015, 12:17:59 pm »
This topic is closed !

Developers / Re: PHP to execute sudo command
« on: October 07, 2015, 09:44:57 pm »
Will do !

Developers / Re: PHP to execute sudo command
« on: October 05, 2015, 09:25:46 pm »
Just posting a quick update .I now have an App working for this project.

Can anyone confirm the blacklist work? For DansGuardian.

Thanks in  advance .

Developers / Re: PHP to execute sudo command
« on: October 04, 2015, 11:42:29 pm »
Hi Guy's.

Back at it again this time with success, last time the exceptioniplist just wouldn't work if you updated the file with an ip address and reload the system, never less to say it was line of code in the php script that was causing the problem and when the file wrote, it wrote as Converted DOS-Formatted, so simple option was to remove the normal jazz and just write out the ip address. and she's now allowing exceptional ip's.

I have made some changes to the script as it didn't want to work with  8.10, the changes are, instead of restarting Dan's, I now have it reloading, which is a lot quicker, created a new bash script to reload Dan's  and  copy the files from /var/www/lmce-admin/dansguardian/files to /etc/dansguardian/lists/.

Now  showing the command on reload
* Reloading DansGuardian configuration...... Reloading DansGuardian configuration files. ...done.
so you can now see it loading instead of waiting 10 seconds for it to restart

Still a working process, but it's working.



Developers / Re: PHP to execute sudo command
« on: August 31, 2015, 07:34:49 pm »
Hi Posde

Nothing out of normal shown in the DansGuardian log, expect the site is denied. see log here

Here's a 4 minute video to review if you have the time. nothing better then a video to explain stuff.

Basically I have purged the DansGuardian and reinstalled it.

I change the /etc/DansGuardian/Lists  to chown www-data:root /etc/dansguardian/lists/*

Edited  bannedsitelist via nano  and added as a blocked site.

Restarted DansGuardian visited the site and its blocked.

Edited the exceptioniplist via nano, added my IP restarted, revisited the site and site was allowed.

I then go to my scripts to update DansGuardian to remove the IP, revisit the site and its blocked.

I enter my IP, update DansGuardian, revisit the site and it's still blocked.

As you can see I in the video, when I edited under nano  it works, and when I execute my php scripts it doesn't.

I see you are on the IRC ...are you availabe to chat.


Developers / Re: PHP to execute sudo command
« on: August 31, 2015, 10:49:12 am »
Hi Posde

Current file permissions shows  and when changed to  www-data for /etc/dansguardian/lists shown here

the files get the same write permissions as root, if change www-data for /etc/dansguardian/lists/* all files have the same write permissions.

Even if you  change  it back to chown root:root /etc/dansguardian/lists/* and edit the file via nano and restart, the list does not execute.

Because you have made changes you can't undo  unless you --purge it from the system.

It's head wrecking, checking the file permissions  on the  files that worked, under Bitvise SSH, I see  they have a group ID 0 & owner ID 0 and are set to 644.

I cannot understand why DNG won't allow this file to be executed when written by www-data, www-data is in the same group as root, them only difference I see is the owner ID is 33  not  0

But as stated above, if you change it back it still doesn't work, crazy tough that the bannedsitelist executes without any issues.

Please advise if I am checking the commands right

compgen -u (shows list of users)
compgen -g (shows list of groups)
ls -la  (shows current owner of directory and file permissions)
getent group www-data (returns the below in bold)

Is there something I am missing ???


Developers / Re: PHP to execute sudo command
« on: August 31, 2015, 12:57:09 am »
Hi Folks

I need a big  help Please :)
I have hit a brick wall with this project. I have spent 10 hours googling and try difference access types but have failed to understand why the exception IP List does not  execute.

Basically, the Exception IP file updates with the correct IP address and DNG restarts no errors, but if you visit the blocked website  you have no access even if you are in the exception list.

These are the options I have tried

sudo apt-get remove dansguardian --purge

sudo apt-get install dansguardian

Edited nano /etc/dansguardian/dansguardian.conf

Restarted, added a domain to block via nano under sudo, restarted, domain blocked, edit the exception ip list via nano under sudo, restarted  website allow.

On clean install it works, but if I run my php scripts it creates the file perfectly, but DNG does execute it.

So I decided to  add www-data to sudo group  as the files are owned by root and then made a change using chown www-data:root /etc/dansguardian/lists/exceptioniplist

restart, website still blocked. everything else works fine so far.

So I purge again for 100 hundred time,  this time  I told the dansguardian.conf to pull from /var/www/lmce-admin/dansguardian/exceptioniplist. restarted still blocked.

So I  cp  -r /etc/dansguardian/lists/exceptioniplist /var/www/lmce-admin/dansguardian restarted and it worked.

It seems to be a permission error, if you cp the from /etc/ the permissions are copied across to the /var  allowing the file to be execute.

I  have even tried  adding  it to the sudoers

%sudo ALL=NOPASSWD: /etc/dansguardian/lists/*
%www-data ALL=(root) NOPASSWD: /etc/dansguardian/lists/*

Still no Joy.

Maybe I am doing something,,,, Any help would be great as the wife is doing her nut in with no access to certain sites.

Once this  has the correct file permissions then I can move on.

So Please  Please help!   


Developers / Re: PHP to execute sudo command
« on: August 30, 2015, 02:29:05 pm »
Sneak preview of DansGuardian config file,

You will be able to update the configuration file in a nice rich PHP format, instead of having use  VI OR Nano  the terminal.


Developers / Re: PHP to execute sudo command
« on: August 30, 2015, 12:32:38 pm »
Hi Folks

Just given a quick update.

In the video I didn't update DansGurdian on the categories section as some of the blacklist files are missing, and in return DansGurdian won't restart as it cannot include the files.

I have updated the blacklist folder from the below url  this even and after extracting more files and folders  are missing.

Update,  I have put in check  to see if the folder exist, if the folder doesn't highlight in RED warning else give a green tick that every is OK to enable

see screen shot here

Update 2
I have now added in a new section to add categories to the database, so if you are updating from ensure to check their live list taken from the category description file in the last build of the blacklist, if you missing some just add the name  of  the one missing, it will create it and save it as disabled by default.

screen shot here

Update 3
Import MD IP address to the exception IP address from the pluto_main database.

I have now got this to import MD IP address on first setup.


Developers / Re: PHP to execute sudo command
« on: August 30, 2015, 12:11:35 am »
Hi Folks

First, I would like to say to Alblasco well done on working on the web-filter and proxy, I had a look at your php scripts and to be honest, they are way to complicated for my PHP skills, but great work tough,  I really need to understand global php verbs.!

I have done great progress in my own project, have fully understood how to execute  sudo commands in PHP, Phenigma, /usr/pluto/bin  is the correct place for .sh files, thanks for the advice.

On that Note..let me get to were  it is.

I can now disable & enable categories .ie blacklist folder,  I can disable and enable the filtering on & off for the system at the click of button, great for when you are web designing and stuff.

So the project is going so good,  with a click of a button I can

Blocked & delete websites 
Add & delete exception IP address
Add & delete exceptional file types
Add & delete  allowed websites
Enabled & disable Categories  .ie blacklist

Check out the this short video clip to  see it in action.

In the video I didn't update DansGurdian on the categories section as some of the blacklist files are missing, and in return DansGurdian won't restart as it cannot include the files.

I have updated the blacklist folder from the below url  this even and after extracting more files and folders  are missing.

When testing this morning I was only missing the below list , but after updating some of them are back and some of them are gone.

virus Infected

So if anyone has a full list/backup please zip it and give me a link to download them so I can fully test it, I would be great full.

To do
Allow time access
Import MD IP address to the exception IP address from the pluto_main database.
Create an Android app for access to the site, for now the browser works well
Add login and password box.

Overall its going good and thanks for reading ...!


Developers / Re: PHP to execute sudo command
« on: August 27, 2015, 11:13:31 pm »
Hi phenigma

No problem at all, I will try and hook up in IRC, it would great if the LMCE users went this, I am offer this for free when I am finish.

What I got done to day is added in the categories to database  and then allow them to be enabled through buttons,  tomorrow I will finish this section off so that it updates the DSG. this was  huge file to get in!

Check this short video clip.

I have also found away to disable filtering and enable it again, but it brings me back visudo to get the command to executed, I go at that tomorrow.

Time to call it night for now  !

Cheers Gov

Developers / Re: PHP to execute sudo command
« on: August 27, 2015, 01:30:18 am »
Hi Posde & Phenigma

Thanks for the replies.

The problem wasn't the PHP script, you had to allow access in the visudo  ( Posde thanks for pointing me in right the direction ), according to a topic on the the internet the permission is

# Cmnd alias specification
Cmnd_Alias DANSGUARDIAN = /etc/init.d/dansguardian, /usr/sbin/dansguardian

# User privilege specification
root ALL=(ALL) ALL
# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL

This allowed PHP to executed the command to restart DansGuardian.

You can see it working in this quick video, to get around the error of no response received from the server after submitting the command,  I put in a 10 second delay, and  then a finish button to bring you back home.

In order for the PHP scripts to work,  visudo has to be edited with the above code, writes access given to the dansguardian LISTS folder.

I have written a  PHP script to check if the database exists, if not, create the database and import the tables.

Here's a short video of it creating the database and then importing the sql file

I am working on this as a plugin, it has its own folder inside  the /var/www/lmce-admin, this allows me to move it to any version of LMCE, the only cache is, DansGuardian and squid3 have to be installed first and some editing done to the IP-tables.

On that note, thanks for the replies I will keep you posted!


Developers / Re: PHP to execute sudo command
« on: August 25, 2015, 01:57:49 pm »
Ah spot on, done some research last night and got it to work, just need to figure out why the page returns an error of no response back from server.

other than that, the project goes. on.

I can now update  blocked sites, added exceptional Ip address and allow  exceptional file types such as .mp3 .zip.

Thanks for the advice Posde much appreciated


Developers / PHP to execute sudo command
« on: August 24, 2015, 10:38:21 pm »
Hi Folks

Working on a little project for dansguardian and squid3, mostly dansguardian,  but have ran into a problem,  is there away for PHP to execute sudo command.

I need to execute  /etc/init.d/dansguardian restart using PHP, I have seen the command in some php files in lmce-admin, but I just  can't get it to work. do I need to include some files belonging to LMCE?

Once I get pass this part my project will rolling, here is a quick video of what I have achieved so far

I have made some changes since this video..etc added in a delete button to remove blocked sites.

Any help would be great,

Pages: [1] 2 3 ... 11