Jump to content

Recommended Posts

Posted

An odd issue with DG webmin (Webmin Module Version 0.7.0beta1b). I can view/edit a groups filter list, click on the appropriate group and click on the relevent list file (such as /etc/dansguardian/lists/bannedsitelist) this will then allow me to add a site and save as appropriate.

 

However. If I state a different file in the base configuration of a particular group - such as pointing "Exception site (domain) list" to say /etc/dansguardian/lists/pupilsexceptionsitelist then I cannot edit this file in webmin. I simply get "You are not authorized to change this file - you will be limited to only viewing this file Expected location: /etc/dansguardian/lists/pupilsexceptionsitelist"

 

The lists work in DG - they act as exceptions just like I assumed they would but I would like to edit them in webmin rather than drop to putty.

 

I initially thought permissions, so I did an ls -l on the "lists directory" but that didnt help:

 

-rwxr-xr-x 1 root root 5285 2009-11-17 15:50 bannedsitelist (works and can be edited in webmin)

-rwxr-xr-x 1 root root 1458 2010-01-13 14:48 pupilsexceptionsitelist (works as a filterlist but cannot be edited in webmin)

 

I must be missing something but i'm darned if I know what. Any ideas?

  • 9 months later...
Posted
No. I have a feeling that webmin has some kind of template and wont let you edit files outside of the template. Annoying as I cant set up webmin for trusted teachers. In the end I just live with it and use putty for those files.
Posted

I did a bit of a dirty work around by editing the webmin module to circumvent the error checking of file access/permissions.

 

I edited this file:

***************************************************************************************

/usr/libexec/webmin/dansguardian/dansguardian-lib.pl

***************************************************************************************

 

Then found this section:

***************************************************************************************

##############

sub accessfile

##############

{

# does the user have permission to modify this file?

my ($filepath) = @_;

($filepath =~ m{\b([^/.]+?)(f\d+)?\.(conf|20\d+)$}) || ($filepath =~ m{\b([^/.]+?)(f\d+)?$});

my $listname = $1;

my $group = $2;

$group = 'local' if ($filepath =~ m/\blocal\b/);

$group = 'f0' if ! $group;

 

(my $branch) = ($filepath =~ m/\b(blacklists|phraselists|authplugins|contentscanners|downloadmanagers)/);

return 0 if ((! $branch) && (! $listname) && (! $group)); # parse failure, wha??? return failure

$listname = 'conf' if $listname eq 'dansguardian';

$listname = $branch if ($branch && (! exists($basefilepermissions{$listname})));

$listname = 'picsfile' if $listname eq 'pics';

$listname =~ s/list.*$/list/ if $listname ne $branch; # truncate filenames only, not directory names

 

if (exists $basefilepermissions{$listname}) {

return 1 if $access{$basefilepermissions{$listname}};

} else {

return 1 if ($access{$listname} && $access{$group});

}

return 0;

}

***************************************************************************************

 

and changed the final "return 0;" to "return 1;" this basically overrides all file access error checking. Yes it is a messy fix but now I can edit my files in webmin. I am sure some time down the road this will come back to haunt me but for now all I care about is that I can edit my DG files via webmin. I think whole issue is due to having webmin and DG running as a different users.

 

James.

  • Thanks 1
Posted
hah! im used to bodging things, no idea why I didnt think of this. Good work (my files were in /usr/share/webmin/dansguardian/ just in case other people have difficulty finding it)
  • 1 year later...
Posted

Thank you for this! In my case I had installed webmin under the same parent directory as MacPorts, so the file path was /opt/local/webmin/dansguardian/dansguardian-lib.pl Anyway, your method totally worked. Thank you again!

 

-- MB

 

I did a bit of a dirty work around by editing the webmin module to circumvent the error checking of file access/permissions.

 

I edited this file:

***************************************************************************************

/usr/libexec/webmin/dansguardian/dansguardian-lib.pl

***************************************************************************************

 

Then found this section:

***************************************************************************************

##############

sub accessfile

##############

{

# does the user have permission to modify this file?

my ($filepath) = @_;

($filepath =~ m{\b([^/.]+?)(f\d+)?\.(conf|20\d+)$}) || ($filepath =~ m{\b([^/.]+?)(f\d+)?$});

my $listname = $1;

my $group = $2;

$group = 'local' if ($filepath =~ m/\blocal\b/);

$group = 'f0' if ! $group;

 

(my $branch) = ($filepath =~ m/\b(blacklists|phraselists|authplugins|contentscanners|downloadmanagers)/);

return 0 if ((! $branch) && (! $listname) && (! $group)); # parse failure, wha??? return failure

$listname = 'conf' if $listname eq 'dansguardian';

$listname = $branch if ($branch && (! exists($basefilepermissions{$listname})));

$listname = 'picsfile' if $listname eq 'pics';

$listname =~ s/list.*$/list/ if $listname ne $branch; # truncate filenames only, not directory names

 

if (exists $basefilepermissions{$listname}) {

return 1 if $access{$basefilepermissions{$listname}};

} else {

return 1 if ($access{$listname} && $access{$group});

}

return 0;

}

***************************************************************************************

 

and changed the final "return 0;" to "return 1;" this basically overrides all file access error checking. Yes it is a messy fix but now I can edit my files in webmin. I am sure some time down the road this will come back to haunt me but for now all I care about is that I can edit my DG files via webmin. I think whole issue is due to having webmin and DG running as a different users.

 

James.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...