Re: Apache2::AuthCookie - semantics of WhatEverPath parameter?

2015-07-27 Thread Jim Garrison
On 7/27/2015 10:30 AM, Jim Garrison wrote:
> Every example for Apache2::AuthCookie shows
> 
> ...
> WhatEverPath /
> ...
> 

That should of course be

PerlSetVar WhatEverPath /

-- 
Jim Garrison (j...@acm.org)
PGP Keys at http://www.jhmg.net RSA 0x04B73B7F DH 0x70738D88


Apache2::AuthCookie - semantics of WhatEverPath parameter?

2015-07-27 Thread Jim Garrison
Every example for Apache2::AuthCookie shows

...
WhatEverPath /
...

but I can find nothing that explains what the value "/" represents.
Is it a URI?  Later in the sample configs we see URIs to which
protection applies are defined by  or  tags,

How does the value of this parameter affect the behavior of AuthCookie,
and under what circumstances would its value not be "/"?

Thanks

-- 
Jim Garrison (j...@acm.org)
PGP Keys at http://www.jhmg.net RSA 0x04B73B7F DH 0x70738D88


Re: PerlSetVar inside doesn't seem to work

2015-07-15 Thread Jim Garrison
On 7/15/2015 5:07 PM, Jim Garrison wrote:
> I have the following config
> 
> 
[snip]
> 
> However it's getting empty strings for the values.  This was working
> when the PerlSetVar directives were outside the VirtualHost block.

It seems when you access dir_config through the ServerRec you only get
values set at the server level. To get the VirtualHost level variables
you must use the RequestRec.  Makes sense, I guess.

Thanks to John Dunlap... your example pointed me in the right direction.

-- 
Jim Garrison (j...@acm.org)
PGP Keys at http://www.jhmg.net RSA 0x04B73B7F DH 0x70738D88


PerlSetVar inside doesn't seem to work

2015-07-15 Thread Jim Garrison
I have the following config


> 
> 
> ...
> 
> PerlOptions +Parent
> PerlSwitches -T -w -I/home/pdxep/gallery
> 
> PerlModule Apache2::Reload
> PerlModule Album
> PerlModule env
> 
> 
> 
> PerlInitHandler Apache2::Reload
> 
> PerlSetVar app_dir  /var/webapp
> PerlSetVar template_dir /templates
> PerlSetVar albums_dir   /albums
> PerlSetVar static_url   /static
> PerlSetVar albums_url   /albums
> 
> SetHandler perl-script
> PerlResponseHandler Album
> 
> 
> 
> 
> SetHandler perl-script
> PerlResponseHandler env
> 
> 
> 

My handler script (Album.pm) retrieves the variables with

my $s = Apache2::ServerUtil->server;
my $app_dir  = $s->dir_config('app_dir');
my $template_dir = $app_dir . $s->dir_config('template_dir');

However it's getting empty strings for the values.  This was working
when the PerlSetVar directives were outside the VirtualHost block.

According to the documentation

https://perl.apache.org/docs/2.0/user/config/config.html#mod_perl_Directives_Argument_Types_and_Allowed_Location

PerlSetVar is scoped "DIR" meaning it can appear in Directory,
Location or Files blocks.  What am I doing wrong?

-- 
Jim Garrison (j...@acm.org)
PGP Keys at http://www.jhmg.net RSA 0x04B73B7F DH 0x70738D88


Apache2::Reload not included, cannot build?

2015-07-09 Thread Jim Garrison
I wanted to use Apache2::Reload but find that it's not included with
the base mod_perl distribution (at least on Centos 6.6).  No problem,
I'll just fire up cpan and build it:

cpan[1]> install Apache2::Reload
CPAN: Storable loaded ok (v2.20)
Reading '/root/.cpan/Metadata'
  Database was generated on Thu, 09 Jul 2015 19:54:32 GMT
Running install for module 'Apache2::Reload'
CPAN: LWP::UserAgent loaded ok (v5.833)
CPAN: Time::HiRes loaded ok (v1.9721)
Fetching with LWP:
http://www.perl.org/CPAN/authors/id/S/SH/SHAY/Apache-Reload-0.13.tar.gz
CPAN: YAML loaded ok (v0.70)
CPAN: Digest::SHA loaded ok (v5.47)
Fetching with LWP:
http://www.perl.org/CPAN/authors/id/S/SH/SHAY/CHECKSUMS
Checksum for
/root/.cpan/sources/authors/id/S/SH/SHAY/Apache-Reload-0.13.tar.gz ok
Scanning cache /root/.cpan/build for sizes
DONE
CPAN: Archive::Tar loaded ok (v1.58)
Apache-Reload-0.13/
Apache-Reload-0.13/Changes
Apache-Reload-0.13/lib/
Apache-Reload-0.13/lib/Apache/
Apache-Reload-0.13/lib/Apache/Reload.pm
Apache-Reload-0.13/lib/Apache2/
Apache-Reload-0.13/lib/Apache2/Reload.pm
Apache-Reload-0.13/LICENSE
Apache-Reload-0.13/Makefile.PL
Apache-Reload-0.13/MANIFEST
Apache-Reload-0.13/META.json
Apache-Reload-0.13/META.yml
Apache-Reload-0.13/README
Apache-Reload-0.13/RELEASE
Apache-Reload-0.13/t/
Apache-Reload-0.13/t/all.t
Apache-Reload-0.13/t/conf/
Apache-Reload-0.13/t/conf/extra.last.conf.in
Apache-Reload-0.13/t/lib/
Apache-Reload-0.13/t/lib/Apache/
Apache-Reload-0.13/t/lib/Apache/TestReload.pm
Apache-Reload-0.13/t/lib/Apache2/
Apache-Reload-0.13/t/lib/Apache2/TestReload.pm
Apache-Reload-0.13/t/reload.t
CPAN: File::Temp loaded ok (v0.22)
CPAN: CPAN::Meta::Requirements loaded ok (v2.133)
CPAN: Parse::CPAN::Meta loaded ok (v1.40)
CPAN: Module::CoreList loaded ok (v2.18)
Configuring S/SH/SHAY/Apache-Reload-0.13.tar.gz with Makefile.PL
Undefined subroutine &Symbol::gensym called at Makefile.PL line 91.
Warning: No success on command[/usr/bin/perl Makefile.PL INSTALLDIRS=site]
  SHAY/Apache-Reload-0.13.tar.gz
  /usr/bin/perl Makefile.PL INSTALLDIRS=site -- NOT OK
Failed during this command:
 SHAY/Apache-Reload-0.13.tar.gz   : writemakefile NO
'/usr/bin/perl Makefile.PL INSTALLDIRS=site' returned status 65280


Googling "Undefined subroutine &Symbol::gensym" turns up only
4 hits, all of them from 2004.

Any suggestions on how to troubleshoot?

-- 
Jim Garrison (j...@acm.org)
PGP Keys at http://www.jhmg.net RSA 0x04B73B7F DH 0x70738D88


Re: mod_perl cannot find startup.pl

2015-07-08 Thread Jim Garrison
On 7/8/2015 4:44 PM, Kevin A. McGrail wrote:
> Anything like selinux? 
> 
> If you put the startup.pl in the same dir as the config file and chown
> to the same user apache is using?
> 
> Regards,
> KAM
> 
> On 7/8/2015 7:38 PM, Jim Garrison wrote:
>> Running Centos 6.6 with Apache 2.2.15 and mod_perl 2.0.4
>>
>> I'm trying to add a startup script (startup.pl) but cannot seem to get
>> mod_perl to find it.  I've reduced the config down to the bare minimum
>> that still reproduces the issue for me.
>>
>> Perl apache configuration:
[snip]


D'OH!!! I was sure I had turned off selinux, but had not.

That was a very good call.

Thank you!

-- 
Jim Garrison (j...@acm.org)
PGP Keys at http://www.jhmg.net RSA 0x04B73B7F DH 0x70738D88


mod_perl cannot find startup.pl

2015-07-08 Thread Jim Garrison
Running Centos 6.6 with Apache 2.2.15 and mod_perl 2.0.4

I'm trying to add a startup script (startup.pl) but cannot seem to get
mod_perl to find it.  I've reduced the config down to the bare minimum
that still reproduces the issue for me.

Perl apache configuration:

LoadModule perl_module modules/mod_perl.so
PerlRequire /home/web/pdxep/startup.pl
PerlSwitches -wT

Contents of /home/web/pdxep/startup.pl

use lib qw(/home/web/pdxep);
1;

When attempting to start Apache:

[Wed Jul 08 16:13:02 2015] [error] Can't locate
/home/web/pdxep/startup.pl in @INC (@INC contains:
/usr/local/lib64/perl5
/usr/local/share/perl5
/usr/lib64/perl5/vendor_perl
/usr/share/perl5/vendor_perl
/usr/lib64/perl5
/usr/share/perl5
/etc/httpd) at (eval 2) line 1.\n
[Wed Jul 08 16:13:02 2015] [error] Can't load Perl file:
/home/web/pdxep/startup.pl for server perseus.jhmg.pvt:0,
exiting...

As a sanity check to show I've verified permissions:

[jhg@perseus pdxep]$ ls -ld / /home /home/web /home/web/pdxep
dr-xr-xr-x. 24 root root   4096 May 26 11:18 /
drwxr-xr-x.  5 root root   4096 Jul  8 14:42 /home
drwxr-xr-x.  3 root root   4096 Jul  8 14:43 /home/web
drwxr-xr-x.  3 jhg  apache 4096 Jul  8 16:04 /home/web/pdxep
[jhg@perseus pdxep]$ ls -l /home/web/pdxep/startup.pl
-rwxr-xr-x. 1 jhg apache 33 Jul  8 16:04 /home/web/pdxep/startup.pl

Also as a sanity check, su to apache and load the startup script:

[jhg@perseus pdxep]$ sudo -s -u apache
bash-4.1$ cd
bash-4.1$ pwd
/var/www
bash-4.1$ perl -de0

Loading DB routines from perl5db.pl version 1.32
Editor support available.

Enter h or `h h' for help, or `man perldebug' for more help.

main::(-e:1):   0
  DB<1> require '/home/web/pdxep/startup.pl';

  DB<2> x @INC
0  '/home/web/pdxep'
1  '/usr/local/lib64/perl5'
2  '/usr/local/share/perl5'
3  '/usr/lib64/perl5/vendor_perl'
4  '/usr/share/perl5/vendor_perl'
5  '/usr/lib64/perl5'
6  '/usr/share/perl5'
7  '.'

The fact that element [0] in @INC has that value shows the script
executed successfully.

Any suggestions on further troubleshooting?

-- 
Jim Garrison (j...@acm.org)
PGP Keys at http://www.jhmg.net RSA 0x04B73B7F DH 0x70738D88