Jamie Cameron | 1 Aug 2007 01:28

Re: [webmin-devel] Debugging and Shorewall module

On 31/Jul/2007 14:12 Paul Gear wrote ..
> Hi folks,
> 
> I've made a few useful (i think) changes to the Shorewall module, and i
> plan to make a few more before i send in the patches.  However, i would
> like to do some more testing & debugging, and i'd like to know what sort
> of debugging tools are at my disposal.
> 
> From what i can tell, the Perl errors from my module actually go nowhere
> at all.  Is this correct/intended?  What is the preferred mechanism to
> capture Perl errors and produce debug output?  I've experimented with
> saving temporary files using a technique i borrowed from another module,
> and that seems to work sometimes, but not always (and possibly is
> dependent upon the actual path used).  I'm confused!  :-(

Hi Paul,
The debugging technique I usually use is to print to STDERR, which is
then logged to /var/webmin/miniserv.error . Not exactly the most modern
technique in this age of source-level debuggers, breakpoints and variable
watching, but it works for me :-)

 - Jamie

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
-
Forwarded by the Webmin development list at webmin-devel <at> webmin.com
(Continue reading)

Paul Gear | 1 Aug 2007 09:35
Picon

Re: [webmin-devel] Debugging and Shorewall module

Jamie Cameron wrote:
> On 31/Jul/2007 14:12 Paul Gear wrote ..
>> Hi folks,
>>
>> I've made a few useful (i think) changes to the Shorewall module, and i
>> plan to make a few more before i send in the patches.  However, i would
>> like to do some more testing & debugging, and i'd like to know what sort
>> of debugging tools are at my disposal.
>>
>> From what i can tell, the Perl errors from my module actually go nowhere
>> at all.  Is this correct/intended?  What is the preferred mechanism to
>> capture Perl errors and produce debug output?  I've experimented with
>> saving temporary files using a technique i borrowed from another module,
>> and that seems to work sometimes, but not always (and possibly is
>> dependent upon the actual path used).  I'm confused!  :-(
> 
> Hi Paul,
> The debugging technique I usually use is to print to STDERR, which is
> then logged to /var/webmin/miniserv.error . Not exactly the most modern
> technique in this age of source-level debuggers, breakpoints and variable
> watching, but it works for me :-)

Works for me - but i'm a bit old-school, too.  ;-)  Here's a first cut
patch at what i've done with Shorewall.  (Important points are in the
changelog.)  I've done some basic testing of the changes, but i'm sure
it could use more.

I wasn't sure about a lot of the webmin idioms for things, so i tried to
preserve the coding style (except for the zero-indent technique!) as
much as i could.  Hope it works for everyone.  I'd appreciate any feedback.
(Continue reading)

Hugo Cornelis | 1 Aug 2007 17:08
Picon
Favicon

Re: [webmin-devel] Debugging and Shorewall module



I use two independent debugging techniques when developing webmin/apache modules:

1. The first one is a kind of logging, complementary to what webmin already does.  Webmin logs to a single file for all requests, I log to a set of rotating files, each file contains a information of the execution of cgi script.  The implementation of this can be found in the sesa scripts, a small application framework on top of webmin (available on sourceforge.net/projects/sesa, the specific files that implement the feature are Sems.pm and Persistency.pm).  The advantage of these log files is that they don't fill your disk (they are rotating), and give you a good history of what a user has done in the recent past.  The disadvantage is obviously performance.

2. From CPAN, there is a module Devel::ptkdb that allows to do source code debugging, also for cgi scripts running on a remote server.  To do this, you set the DISPLAY variable to your display (where your browser is runnning), in a very first _BEGIN_ block in your cgi script.  Then, second, you use the interpreter sequence '#!/usr/bin/perl -d:ptkdb' to call the debugger.  Then, make a request to the server, such that it executes your cgi script.  Perhaps small changes are required to the webmin configuration, I am not entirely sure about it (e.g. to fork cgi scripts ?).  I have used this technique a lot for debugging complicated cgi scripts.


Hugo


Paul Gear <paul <at> gear.dyndns.org> wrote:
Hi folks,

I've made a few useful (i think) changes to the Shorewall module, and i
plan to make a few more before i send in the patches. However, i would
like to do some more testing & debugging, and i'd like to know what sort
of debugging tools are at my disposal.

From what i can tell, the Perl errors from my module actually go nowhere
at all. Is this correct/intended? What is the preferred mechanism to
capture Perl errors and produce debug output? I've experimented with
saving temporary files using a technique i borrowed from another module,
and that seems to work sometimes, but not always (and possibly is
dependent upon the actual path used). I'm confused! :-(

Thanks in advance,
Paul

--
Did you know? It is illegal to use your copy of Microsoft Office on
multiple computers without multiple licenses. Why not try the free
alternative OpenOffice.org?

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/-
Forwarded by the Webmin development list at webmin-devel <at> webmin.com
To remove yourself from this list, go to
http://lists.sourceforge.net/lists/listinfo/webadmin-devel

Take the Internet to Go: Yahoo!Go puts the Internet in your pocket: mail, news, photos & more.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
-
Forwarded by the Webmin development list at webmin-devel <at> webmin.com
To remove yourself from this list, go to
http://lists.sourceforge.net/lists/listinfo/webadmin-devel
Jamie Cameron | 2 Aug 2007 10:12

Re: [webmin-devel] Debugging and Shorewall module

On 1/Aug/2007 00:35 Paul Gear wrote ..
> Jamie Cameron wrote:
> > On 31/Jul/2007 14:12 Paul Gear wrote ..
> >> Hi folks,
> >>
> >> I've made a few useful (i think) changes to the Shorewall module, and
> i
> >> plan to make a few more before i send in the patches.  However, i would
> >> like to do some more testing & debugging, and i'd like to know what
> sort
> >> of debugging tools are at my disposal.
> >>
> >> From what i can tell, the Perl errors from my module actually go nowhere
> >> at all.  Is this correct/intended?  What is the preferred mechanism
> to
> >> capture Perl errors and produce debug output?  I've experimented with
> >> saving temporary files using a technique i borrowed from another module,
> >> and that seems to work sometimes, but not always (and possibly is
> >> dependent upon the actual path used).  I'm confused!  :-(
> > 
> > Hi Paul,
> > The debugging technique I usually use is to print to STDERR, which is
> > then logged to /var/webmin/miniserv.error . Not exactly the most modern
> > technique in this age of source-level debuggers, breakpoints and variable
> > watching, but it works for me :-)
> 
> Works for me - but i'm a bit old-school, too.  ;-)  Here's a first cut
> patch at what i've done with Shorewall.  (Important points are in the
> changelog.)  I've done some basic testing of the changes, but i'm sure
> it could use more.
> 
> I wasn't sure about a lot of the webmin idioms for things, so i tried to
> preserve the coding style (except for the zero-indent technique!) as
> much as i could.  Hope it works for everyone.  I'd appreciate any feedback.

Thanks for the patch! I'll take a closer look at it tomorrow ..

 - Jamie

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
-
Forwarded by the Webmin development list at webmin-devel <at> webmin.com
To remove yourself from this list, go to
http://lists.sourceforge.net/lists/listinfo/webadmin-devel

Jamie Cameron | 2 Aug 2007 22:15

Re: [webmin-devel] Debugging and Shorewall module

On 1/Aug/2007 00:35 Paul Gear wrote ..
> Jamie Cameron wrote:
> > On 31/Jul/2007 14:12 Paul Gear wrote ..
> >> Hi folks,
> >>
> >> I've made a few useful (i think) changes to the Shorewall module, and
> i
> >> plan to make a few more before i send in the patches.  However, i would
> >> like to do some more testing & debugging, and i'd like to know what
> sort
> >> of debugging tools are at my disposal.
> >>
> >> From what i can tell, the Perl errors from my module actually go nowhere
> >> at all.  Is this correct/intended?  What is the preferred mechanism
> to
> >> capture Perl errors and produce debug output?  I've experimented with
> >> saving temporary files using a technique i borrowed from another module,
> >> and that seems to work sometimes, but not always (and possibly is
> >> dependent upon the actual path used).  I'm confused!  :-(
> > 
> > Hi Paul,
> > The debugging technique I usually use is to print to STDERR, which is
> > then logged to /var/webmin/miniserv.error . Not exactly the most modern
> > technique in this age of source-level debuggers, breakpoints and variable
> > watching, but it works for me :-)
> 
> Works for me - but i'm a bit old-school, too.  ;-)  Here's a first cut
> patch at what i've done with Shorewall.  (Important points are in the
> changelog.)  I've done some basic testing of the changes, but i'm sure
> it could use more.
> 
> I wasn't sure about a lot of the webmin idioms for things, so i tried to
> preserve the coding style (except for the zero-indent technique!) as
> much as i could.  Hope it works for everyone.  I'd appreciate any feedback.

Ok, the patch looks good. I have applied it to my source tree, and will
include it in the Webmin 1.350 release, which I plan to build today. 

Thanks again!

 - Jamie

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
-
Forwarded by the Webmin development list at webmin-devel <at> webmin.com
To remove yourself from this list, go to
http://lists.sourceforge.net/lists/listinfo/webadmin-devel

Paul Gear | 4 Aug 2007 01:26
Picon

Re: [webmin-devel] Debugging and Shorewall module

Jamie Cameron wrote:
> On 1/Aug/2007 00:35 Paul Gear wrote ..
>> Jamie Cameron wrote:
>> ...
>> I wasn't sure about a lot of the webmin idioms for things, so i tried to
>> preserve the coding style (except for the zero-indent technique!) as
>> much as i could.  Hope it works for everyone.  I'd appreciate any feedback.
> 
> Ok, the patch looks good. I have applied it to my source tree, and will
> include it in the Webmin 1.350 release, which I plan to build today. 

There is at least one user-visible problem in what i've done, which is
no icons for the params & shorewall.conf configs.  I'm not much at
art...  ;-)

-- 
Paul
<http://paulgear.webhop.net>
--
Tired of paying for Microsoft Office?  Running an illegal copy and want
to make it legal?  Try OpenOffice.org!  It's free and does most of the
things Microsoft Office does.  <http://www.openoffice.org>

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
-
Forwarded by the Webmin development list at webmin-devel <at> webmin.com
To remove yourself from this list, go to
http://lists.sourceforge.net/lists/listinfo/webadmin-devel
Jamie Cameron | 4 Aug 2007 01:30

Re: [webmin-devel] Debugging and Shorewall module

On 3/Aug/2007 16:26 Paul Gear wrote ..
> Jamie Cameron wrote:
> > On 1/Aug/2007 00:35 Paul Gear wrote ..
> >> Jamie Cameron wrote:
> >> ...
> >> I wasn't sure about a lot of the webmin idioms for things, so i tried
> to
> >> preserve the coding style (except for the zero-indent technique!) as
> >> much as i could.  Hope it works for everyone.  I'd appreciate any feedback.
> > 
> > Ok, the patch looks good. I have applied it to my source tree, and will
> > include it in the Webmin 1.350 release, which I plan to build today.
> 
> There is at least one user-visible problem in what i've done, which is
> no icons for the params & shorewall.conf configs.  I'm not much at
> art...  ;-)

No worries, I'll make some up ..

 - Jamie

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
-
Forwarded by the Webmin development list at webmin-devel <at> webmin.com
To remove yourself from this list, go to
http://lists.sourceforge.net/lists/listinfo/webadmin-devel

Fran Fabrizio | 30 Aug 2007 16:41
Picon
Favicon

[webmin-devel] Temporary user account disabling - mechanism details


Can someone briefly explain or point to me where in the code the
behavior to temporarily disable accounts (I'm specifically looking at
the LDAP module but this may be more general than that)?  I have peeked
at the code and I thought it was some method of appending/prepending a
string onto the crypt'ed password string to disable it, but I notice
that the crypt'ed string doesn't change when I disable an account.  I
need to disable about 1,000 accounts, and I remembered that webmin had
this function, but I want to script similar behavior in this case if I can.

Thanks,
Fran

--

-- 
Fran Fabrizio
Senior Systems Analyst
Department of Computer and Information Sciences
University of Alabama at Birmingham
http://www.cis.uab.edu/
205.934.0653 

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
-
Forwarded by the Webmin development list at webmin-devel <at> webmin.com
To remove yourself from this list, go to
http://lists.sourceforge.net/lists/listinfo/webadmin-devel

Jamie Cameron | 30 Aug 2007 18:24

Re: [webmin-devel] Temporary user account disabling - mechanism details

On 30/Aug/2007 07:41 Fran Fabrizio wrote ..
> 
> Can someone briefly explain or point to me where in the code the
> behavior to temporarily disable accounts (I'm specifically looking at
> the LDAP module but this may be more general than that)?  I have peeked
> at the code and I thought it was some method of appending/prepending a
> string onto the crypt'ed password string to disable it, but I notice
> that the crypt'ed string doesn't change when I disable an account.  I
> need to disable about 1,000 accounts, and I remembered that webmin had
> this function, but I want to script similar behavior in this case if I
> can.

Hi Fran,

The way Webmin does it is to prepend a ! to the encrypted password, which
makes it invalid. This can be easily removed by the code when you want
to re-enable the account.

You can see this in the code in ldap-useradmin/save_user.cgi line 264.

 - Jamie

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
-
Forwarded by the Webmin development list at webmin-devel <at> webmin.com
To remove yourself from this list, go to
http://lists.sourceforge.net/lists/listinfo/webadmin-devel


Gmane