Re: phpmyadmin config and readme

2017-03-24 Thread Giovanni Bechis
On Tue, Mar 21, 2017 at 07:56:55AM +, Stuart Henderson wrote:
> On 2017/03/20 15:03, Paul Irofti wrote:
> >  phpMyAdmin has been installed into ${INSTDIR}.
> >  
> >  If using Apache, you can make this accessible to clients by enabling
> > -the configuration file:
> > +mod_rewrite in ${SYSCONFDIR}/apache2/httpd2.conf, the mysql php module,
> > +and the configuration file:
> >  
> >  # ln -s ../modules.sample/phpmyadmin.conf /var/www/conf/modules/
> > +# cp /etc/php-5.6.sample/mysqli.ini /etc/php-5.6/
> 
> Please symlink rather than cp, and use variables so this doesn't
> get stale after a PHP update:
> 
> # ln -s ../php-${MODPHP_VERSION}.sample/mysqli.ini 
> ${SYSCONFDIR}/php-${MODPHP_VERSION}/
> 
what about this one ?
I added an nginx example and renamed the httpd file to apache2, 
phpmyadmin-httpd will be the httpd(8) example.
  Cheers
   Giovanni
Index: Makefile
===
RCS file: /var/cvs/ports/www/phpmyadmin/Makefile,v
retrieving revision 1.128
diff -u -p -r1.128 Makefile
--- Makefile1 Feb 2017 08:52:36 -   1.128
+++ Makefile24 Mar 2017 21:04:21 -
@@ -3,6 +3,7 @@
 COMMENT=   tool to handle the administration of MySQL over the web
 
 V= 4.6.6
+REVISION=  0
 
 PKGNAME=   phpMyAdmin-$V
 DISTNAME=  phpMyAdmin-$V-all-languages
@@ -32,8 +33,10 @@ RUN_DEPENDS= lang/php/${MODPHP_VERSION},
lang/php/${MODPHP_VERSION},-gd
 
 post-extract:
-   ${SUBST_CMD} -m 0644 -c ${FILESDIR}/phpMyAdmin-httpd.conf \
-   ${WRKSRC}/examples/phpMyAdmin-httpd.conf
+   ${SUBST_CMD} -m 0644 -c ${FILESDIR}/phpMyAdmin-apache2.conf \
+   ${WRKSRC}/examples/phpMyAdmin-apache2.conf
+   ${SUBST_CMD} -m 0644 -c ${FILESDIR}/phpMyAdmin-nginx.conf \
+   ${WRKSRC}/examples/phpMyAdmin-nginx.conf
 
 do-install:
@find ${WRKSRC} -type f -name "*.orig" -exec rm -f {} \;
Index: files/phpMyAdmin-apache2.conf
===
RCS file: files/phpMyAdmin-apache2.conf
diff -N files/phpMyAdmin-apache2.conf
--- /dev/null   1 Jan 1970 00:00:00 -
+++ files/phpMyAdmin-apache2.conf   20 Mar 2017 15:09:51 -
@@ -0,0 +1,33 @@
+# $OpenBSD: phpMyAdmin-httpd.conf,v 1.2 2013/01/18 15:17:43 giovanni Exp $
+
+Alias /phpMyAdmin ${INSTDIR}
+
+
+   LoadModule rewrite_module /usr/lib/apache/modules/mod_rewrite.so
+
+   RewriteEngine on
+
+   # Allow only GET and POST verbs
+   RewriteCond %{REQUEST_METHOD} !^(GET|POST)$ [NC,OR]
+
+   # Ban Typical Vulnerability Scanners and others
+   # Kick out Script Kiddies
+   RewriteCond %{HTTP_USER_AGENT} ^(java|curl|wget).* [NC,OR]
+   RewriteCond %{HTTP_USER_AGENT} 
^.*(libwww-perl|curl|wget|python|nikto|wkito|pikto|scan|acunetix).* [NC,OR]
+   RewriteCond %{HTTP_USER_AGENT} 
^.*(winhttp|HTTrack|clshttp|archiver|loader|email|harvest|extract|grab|miner).* 
[NC,OR]
+
+   # Ban Search Engines, Crawlers to your administrative panel
+   # No reasons to access from bots
+   # Ultimately Better than the useless robots.txt
+   # Did google respect robots.txt?
+   # Try google: intitle:phpMyAdmin intext:"Welcome to phpMyAdmin *.*.*" 
intext:"Log in" -wiki -forum -forums -questions intext:"Cookies must be enabled"
+   RewriteCond %{HTTP_USER_AGENT} 
^.*(AdsBot-Google|ia_archiver|Scooter|Ask.Jeeves|Baiduspider|Exabot|FAST.Enterprise.Crawler|FAST-WebCrawler|www\.neomo\.de|Gigabot|Mediapartners-Google|Google.Desktop|Feedfetcher-Google|Googlebot|heise-IT-Markt-Crawler|heritrix|ibm.com\cs/crawler|ICCrawler|ichiro|MJ12bot|MetagerBot|msnbot-NewsBlogs|msnbot|msnbot-media|NG-Search|lucene.apache.org|NutchCVS|OmniExplorer_Bot|online.link.validator|psbot0|Seekbot|Sensis.Web.Crawler|SEO.search.Crawler|Seoma.\[SEO.Crawler\]|SEOsearch|Snappy|www.urltrends.com|www.tkl.iis.u-tokyo.ac.jp/~crawler|SynooBot|crawleradmin.t-i...@telekom.de|TurnitinBot|voyager|W3.SiteSearch.Crawler|W3C-checklink|W3C_Validator|www.WISEnutbot.com|yacybot|Yahoo-MMCrawler|Yahoo\!.DE.Slurp|Yahoo\!.Slurp|YahooSeeker).*
 [NC]
+   RewriteRule .* - [F]
+
+
+
+   AllowOverride All
+
+   # Default to only permitting access from localhost.
+   Require local
+
Index: files/phpMyAdmin-httpd.conf
===
RCS file: files/phpMyAdmin-httpd.conf
diff -N files/phpMyAdmin-httpd.conf
--- files/phpMyAdmin-httpd.conf 18 Jan 2013 15:17:43 -  1.2
+++ /dev/null   1 Jan 1970 00:00:00 -
@@ -1,35 +0,0 @@
-# $OpenBSD: phpMyAdmin-httpd.conf,v 1.2 2013/01/18 15:17:43 giovanni Exp $
-
-Alias /phpMyAdmin ${INSTDIR}
-
-
-   LoadModule rewrite_module /usr/lib/apache/modules/mod_rewrite.so
-
-   RewriteEngine on
-
-   # Allow only GET and POST verbs
-   RewriteCond %{REQUEST_METHOD} !^(GET|POST)$ [NC,OR]
-
-   # Ban Typical Vulnerability Scanners and others
-   # Kick out Script Kiddies
-   RewriteCond 

Re: phpmyadmin config and readme

2017-03-21 Thread Antoine Jacoutot
On Tue, Mar 21, 2017 at 01:02:47PM +0200, Paul Irofti wrote:
> On Tue, Mar 21, 2017 at 07:56:55AM +, Stuart Henderson wrote:
> > On 2017/03/20 15:03, Paul Irofti wrote:
> > >  phpMyAdmin has been installed into ${INSTDIR}.
> > >  
> > >  If using Apache, you can make this accessible to clients by enabling
> > > -the configuration file:
> > > +mod_rewrite in ${SYSCONFDIR}/apache2/httpd2.conf, the mysql php module,
> > > +and the configuration file:
> > >  
> > >  # ln -s ../modules.sample/phpmyadmin.conf /var/www/conf/modules/
> > > +# cp /etc/php-5.6.sample/mysqli.ini /etc/php-5.6/
> > 
> > Please symlink rather than cp, and use variables so this doesn't
> > get stale after a PHP update:
> > 
> > # ln -s ../php-${MODPHP_VERSION}.sample/mysqli.ini 
> > ${SYSCONFDIR}/php-${MODPHP_VERSION}/
> 
> Good point on the variables!
> 
> I actually wanted to discus ln -s vs. cp. Isn't this a bad idea in
> general? For the php bit I agree that it is useless to copy, but for the
> phpmyadmin.conf I think it's actually required to cp instead of link: if
> I customize the config I also modify the sample file which will get
> overwritten by an update or pkg_add will scream about a bad checksum,
> right?

No, because phpmyadmin.conf is a @sample. It will only be overwritten if it was
not locally modified.

-- 
Antoine



Re: phpmyadmin config and readme

2017-03-21 Thread Giovanni Bechis
On 03/21/17 12:11, Giovanni Bechis wrote:
> On 03/21/17 12:02, Paul Irofti wrote:
>> On Tue, Mar 21, 2017 at 07:56:55AM +, Stuart Henderson wrote:
>>> On 2017/03/20 15:03, Paul Irofti wrote:
  phpMyAdmin has been installed into ${INSTDIR}.
  
  If using Apache, you can make this accessible to clients by enabling
 -the configuration file:
 +mod_rewrite in ${SYSCONFDIR}/apache2/httpd2.conf, the mysql php module,
 +and the configuration file:
  
  # ln -s ../modules.sample/phpmyadmin.conf /var/www/conf/modules/
 +# cp /etc/php-5.6.sample/mysqli.ini /etc/php-5.6/
>>>
>>> Please symlink rather than cp, and use variables so this doesn't
>>> get stale after a PHP update:
>>>
>>> # ln -s ../php-${MODPHP_VERSION}.sample/mysqli.ini 
>>> ${SYSCONFDIR}/php-${MODPHP_VERSION}/
>>
>> Good point on the variables!
>>
>> I actually wanted to discus ln -s vs. cp. Isn't this a bad idea in
>> general? For the php bit I agree that it is useless to copy, but for the
>> phpmyadmin.conf I think it's actually required to cp instead of link: if
>> I customize the config I also modify the sample file which will get
>> overwritten by an update or pkg_add will scream about a bad checksum,
>> right?
>>
> exactly, config.inc.php should not be a symlink.
>  Giovanni
> 
s/config\.inc\.php/phpmyadmin\.conf/



Re: phpmyadmin config and readme

2017-03-21 Thread Giovanni Bechis
On 03/21/17 12:02, Paul Irofti wrote:
> On Tue, Mar 21, 2017 at 07:56:55AM +, Stuart Henderson wrote:
>> On 2017/03/20 15:03, Paul Irofti wrote:
>>>  phpMyAdmin has been installed into ${INSTDIR}.
>>>  
>>>  If using Apache, you can make this accessible to clients by enabling
>>> -the configuration file:
>>> +mod_rewrite in ${SYSCONFDIR}/apache2/httpd2.conf, the mysql php module,
>>> +and the configuration file:
>>>  
>>>  # ln -s ../modules.sample/phpmyadmin.conf /var/www/conf/modules/
>>> +# cp /etc/php-5.6.sample/mysqli.ini /etc/php-5.6/
>>
>> Please symlink rather than cp, and use variables so this doesn't
>> get stale after a PHP update:
>>
>> # ln -s ../php-${MODPHP_VERSION}.sample/mysqli.ini 
>> ${SYSCONFDIR}/php-${MODPHP_VERSION}/
> 
> Good point on the variables!
> 
> I actually wanted to discus ln -s vs. cp. Isn't this a bad idea in
> general? For the php bit I agree that it is useless to copy, but for the
> phpmyadmin.conf I think it's actually required to cp instead of link: if
> I customize the config I also modify the sample file which will get
> overwritten by an update or pkg_add will scream about a bad checksum,
> right?
> 
exactly, config.inc.php should not be a symlink.
 Giovanni



Re: phpmyadmin config and readme

2017-03-21 Thread Paul Irofti
On Tue, Mar 21, 2017 at 07:56:55AM +, Stuart Henderson wrote:
> On 2017/03/20 15:03, Paul Irofti wrote:
> >  phpMyAdmin has been installed into ${INSTDIR}.
> >  
> >  If using Apache, you can make this accessible to clients by enabling
> > -the configuration file:
> > +mod_rewrite in ${SYSCONFDIR}/apache2/httpd2.conf, the mysql php module,
> > +and the configuration file:
> >  
> >  # ln -s ../modules.sample/phpmyadmin.conf /var/www/conf/modules/
> > +# cp /etc/php-5.6.sample/mysqli.ini /etc/php-5.6/
> 
> Please symlink rather than cp, and use variables so this doesn't
> get stale after a PHP update:
> 
> # ln -s ../php-${MODPHP_VERSION}.sample/mysqli.ini 
> ${SYSCONFDIR}/php-${MODPHP_VERSION}/

Good point on the variables!

I actually wanted to discus ln -s vs. cp. Isn't this a bad idea in
general? For the php bit I agree that it is useless to copy, but for the
phpmyadmin.conf I think it's actually required to cp instead of link: if
I customize the config I also modify the sample file which will get
overwritten by an update or pkg_add will scream about a bad checksum,
right?



Re: phpmyadmin config and readme

2017-03-21 Thread Stuart Henderson
On 2017/03/20 15:03, Paul Irofti wrote:
>  phpMyAdmin has been installed into ${INSTDIR}.
>  
>  If using Apache, you can make this accessible to clients by enabling
> -the configuration file:
> +mod_rewrite in ${SYSCONFDIR}/apache2/httpd2.conf, the mysql php module,
> +and the configuration file:
>  
>  # ln -s ../modules.sample/phpmyadmin.conf /var/www/conf/modules/
> +# cp /etc/php-5.6.sample/mysqli.ini /etc/php-5.6/

Please symlink rather than cp, and use variables so this doesn't
get stale after a PHP update:

# ln -s ../php-${MODPHP_VERSION}.sample/mysqli.ini 
${SYSCONFDIR}/php-${MODPHP_VERSION}/



Re: phpmyadmin config and readme

2017-03-20 Thread Paul Irofti
On Mon, Mar 20, 2017 at 03:00:29PM +0100, Giovanni Bechis wrote:
> On 03/20/17 14:59, Paul Irofti wrote:
> > On Mon, Mar 20, 2017 at 02:57:21PM +0100, Giovanni Bechis wrote:
> >> On 03/20/17 14:03, Paul Irofti wrote:
> >>> Hi,
> >>>
> >>> I think both the readme and the apache configuration need an update.
> >>> There are more things to enable before phpmyadmin can work and
> >>> restricting local access is done differently since apache 2.4. OK?
> >>>
> >> Sure, go for it.
> >> I do not use Apache since $ages.
> > 
> > Are you using this with httpd? I tried for 10 minutes but then give up
> > as it was taking too much time for such a trivial task.
> > 
> I am not using httpd(8) yet, I moved to nginx(8) and never come back (yet).

Why don't you add an example for nginx as well then? :)



Re: phpmyadmin config and readme

2017-03-20 Thread Giovanni Bechis
On 03/20/17 14:59, Paul Irofti wrote:
> On Mon, Mar 20, 2017 at 02:57:21PM +0100, Giovanni Bechis wrote:
>> On 03/20/17 14:03, Paul Irofti wrote:
>>> Hi,
>>>
>>> I think both the readme and the apache configuration need an update.
>>> There are more things to enable before phpmyadmin can work and
>>> restricting local access is done differently since apache 2.4. OK?
>>>
>> Sure, go for it.
>> I do not use Apache since $ages.
> 
> Are you using this with httpd? I tried for 10 minutes but then give up
> as it was taking too much time for such a trivial task.
> 
I am not using httpd(8) yet, I moved to nginx(8) and never come back (yet).
 Giovanni



Re: phpmyadmin config and readme

2017-03-20 Thread Paul Irofti
On Mon, Mar 20, 2017 at 02:57:21PM +0100, Giovanni Bechis wrote:
> On 03/20/17 14:03, Paul Irofti wrote:
> > Hi,
> > 
> > I think both the readme and the apache configuration need an update.
> > There are more things to enable before phpmyadmin can work and
> > restricting local access is done differently since apache 2.4. OK?
> > 
> Sure, go for it.
> I do not use Apache since $ages.

Are you using this with httpd? I tried for 10 minutes but then give up
as it was taking too much time for such a trivial task.



Re: phpmyadmin config and readme

2017-03-20 Thread Giovanni Bechis
On 03/20/17 14:03, Paul Irofti wrote:
> Hi,
> 
> I think both the readme and the apache configuration need an update.
> There are more things to enable before phpmyadmin can work and
> restricting local access is done differently since apache 2.4. OK?
> 
Sure, go for it.
I do not use Apache since $ages.
 Giovanni

> Paul
> 
> 
> Index: Makefile
> ===
> RCS file: /cvs/ports/www/phpmyadmin/Makefile,v
> retrieving revision 1.128
> diff -u -p -u -p -r1.128 Makefile
> --- Makefile  1 Feb 2017 08:52:36 -   1.128
> +++ Makefile  20 Mar 2017 13:00:01 -
> @@ -3,6 +3,7 @@
>  COMMENT= tool to handle the administration of MySQL over the web
>  
>  V=   4.6.6
> +REVISION=0
>  
>  PKGNAME= phpMyAdmin-$V
>  DISTNAME=phpMyAdmin-$V-all-languages
> Index: files/phpMyAdmin-httpd.conf
> ===
> RCS file: /cvs/ports/www/phpmyadmin/files/phpMyAdmin-httpd.conf,v
> retrieving revision 1.2
> diff -u -p -u -p -r1.2 phpMyAdmin-httpd.conf
> --- files/phpMyAdmin-httpd.conf   18 Jan 2013 15:17:43 -  1.2
> +++ files/phpMyAdmin-httpd.conf   20 Mar 2017 13:00:01 -
> @@ -29,7 +29,5 @@ Alias /phpMyAdmin ${INSTDIR}
>   AllowOverride All
>  
>   # Default to only permitting access from localhost.
> - Order deny,allow
> - Deny from all
> - Allow from 127.0.0.1
> + Require local
>  
> Index: pkg/README
> ===
> RCS file: /cvs/ports/www/phpmyadmin/pkg/README,v
> retrieving revision 1.5
> diff -u -p -u -p -r1.5 README
> --- pkg/README1 Sep 2016 15:23:55 -   1.5
> +++ pkg/README20 Mar 2017 13:00:01 -
> @@ -7,9 +7,11 @@ $OpenBSD: README,v 1.5 2016/09/01 15:23:
>  phpMyAdmin has been installed into ${INSTDIR}.
>  
>  If using Apache, you can make this accessible to clients by enabling
> -the configuration file:
> +mod_rewrite in ${SYSCONFDIR}/apache2/httpd2.conf, the mysql php module,
> +and the configuration file:
>  
>  # ln -s ../modules.sample/phpmyadmin.conf /var/www/conf/modules/
> +# cp /etc/php-5.6.sample/mysqli.ini /etc/php-5.6/
>  # /etc/rc.d/apache2 restart
>  
>  By default, this sets an alias for /phpMyAdmin and restricts access
> 



phpmyadmin config and readme

2017-03-20 Thread Paul Irofti
Hi,

I think both the readme and the apache configuration need an update.
There are more things to enable before phpmyadmin can work and
restricting local access is done differently since apache 2.4. OK?

Paul


Index: Makefile
===
RCS file: /cvs/ports/www/phpmyadmin/Makefile,v
retrieving revision 1.128
diff -u -p -u -p -r1.128 Makefile
--- Makefile1 Feb 2017 08:52:36 -   1.128
+++ Makefile20 Mar 2017 13:00:01 -
@@ -3,6 +3,7 @@
 COMMENT=   tool to handle the administration of MySQL over the web
 
 V= 4.6.6
+REVISION=  0
 
 PKGNAME=   phpMyAdmin-$V
 DISTNAME=  phpMyAdmin-$V-all-languages
Index: files/phpMyAdmin-httpd.conf
===
RCS file: /cvs/ports/www/phpmyadmin/files/phpMyAdmin-httpd.conf,v
retrieving revision 1.2
diff -u -p -u -p -r1.2 phpMyAdmin-httpd.conf
--- files/phpMyAdmin-httpd.conf 18 Jan 2013 15:17:43 -  1.2
+++ files/phpMyAdmin-httpd.conf 20 Mar 2017 13:00:01 -
@@ -29,7 +29,5 @@ Alias /phpMyAdmin ${INSTDIR}
AllowOverride All
 
# Default to only permitting access from localhost.
-   Order deny,allow
-   Deny from all
-   Allow from 127.0.0.1
+   Require local
 
Index: pkg/README
===
RCS file: /cvs/ports/www/phpmyadmin/pkg/README,v
retrieving revision 1.5
diff -u -p -u -p -r1.5 README
--- pkg/README  1 Sep 2016 15:23:55 -   1.5
+++ pkg/README  20 Mar 2017 13:00:01 -
@@ -7,9 +7,11 @@ $OpenBSD: README,v 1.5 2016/09/01 15:23:
 phpMyAdmin has been installed into ${INSTDIR}.
 
 If using Apache, you can make this accessible to clients by enabling
-the configuration file:
+mod_rewrite in ${SYSCONFDIR}/apache2/httpd2.conf, the mysql php module,
+and the configuration file:
 
 # ln -s ../modules.sample/phpmyadmin.conf /var/www/conf/modules/
+# cp /etc/php-5.6.sample/mysqli.ini /etc/php-5.6/
 # /etc/rc.d/apache2 restart
 
 By default, this sets an alias for /phpMyAdmin and restricts access