Friday, July 22, 2022

Basic HTTP auth with lighttpd, mod_authn_dbi and stored PLAIN PASSWORDS

First, if you can avoid storing PLAIN PASSWORDS - avoid them and do not read this at all!

Next,
auth.backend = "dbi"
auth.backend.dbi += (
  "sql" => "select md5(concat(username,':MyRealm:',password)) where username = '?'" ,
  "dbtype" => "mysql",
  "dbname" => "mymydb",
  "username" => "mymylogin",
  "password" => "mymypassword"
)
auth.require = (
  "/" => 
  (
   "method" => "basic",
   "realm" => "MyRealm", # The same realm as in sql statement!
   "require" => "valid-user"
  )
)


Generally speaking, I do not understand the authors of lighttpd (which is my web-server of choice for around 10 years) in this exact logic and their love of Digest auth (I prefer Basic+https).
This works at least for lighttpd 1.4.65
Crossposted to linkedin

Saturday, January 15, 2022

Ikea Tradfri hub loosing connectivity

Ikea Tradfri Zigbee controllers are known sometimes to get offline, a lot of people over inet complaining on that. In case it is rebooted, it is working. The less known thing is the network disconnect also restores availability. However, disabling/enabling port on switch does not work, because some of the devices just stops transmission over ethernet port. The thing that helps is speed changing to 10mbps and back! I have my Ikea Tradfri hubs running for several months. The server pings them and if it loses connectivity, I just change the speed of the ethernet ports -- and viola! - my Tradfri hub is back online. The other problem is when devices goes offline, I have no solution -- and I do not even know how to detect that via COAPS....

Monday, October 25, 2021

Prosody on OpenBSD 7.0

after upgrade OpenBSD to 7.0, I've got " Cannot load driver MySQL. Available drivers are: SQLite3" pkg_add lua52dbi-mysql helped. Yes, that's all I want to say about that!

Saturday, May 8, 2021

Compiling LIRC on Void Linux

After compiling I've noticed that 'default' driver is missing, this makes it unusable on Raspberry PI1. The trick is #include <sys/sysmacros.h> in plugins/default.c somewhere around line 35.

Saturday, April 27, 2019

pmwiki and lighttpd

Just my config, nothing more!
$HTTP["host"] == "wiki.MYDOMAIN.TLD" {
 $HTTP["remoteip"] !~ "^2001:START-OF-MY-IPV6-ADDR" {                                                        
  url.access-deny = ( "" )                                                                      
 }

 $HTTP["remoteip"] =~ "^2001:START-OF-MY-IPV6-ADDR" {
  url.rewrite-once = (
  "^/wiki/?([^?]*)$" => "/pmwiki.php?n=$1",
  "^/wiki/?([^?]*)[?](.*)$" => "/pmwiki.php?n=$1&$2"
 }

 url.rewrite = (                                                                                
  "^/scripts/" => "404.html",                                                                   
  "^/wiki\.d/" => "404.html",                                                                   
  "^/local/" => "404.html",                                                                     
  "^/cookcook/" => "404.html"                                                                   
 )
 fastcgi.server = ( ".php" =>                                                                   
                  ( "php-tcp3" =>                                                               
                     (                                                                          
                       "host" => "127.0.0.1",                                                   
                       "port" => 9003,                                                          
# Do not check file exists on server side                                                       
                       "check-local" => "disable",                                              
# Some php stuff                                                                                
                       "broken-scriptfilename" => "enable",                                     
# Docroot comes from sql in my case "docroot" => "/var/www"                 
                        ,"fix-root-scriptname" => "enable"                                      
                     )                                                                          
                   ),                                                                           
 ) 

}

Tuesday, January 22, 2019

ZyWALL, D-Link DFL-860, NAT-T: tricks and throughput

I have Dlink DFL-860 running as IPSEC server. I've tried to connect to it with Zywall W30 and Zywall 2 behind of NAT, calling DFL.
That's possible. The trick is to set "My Address" of ZyWalls to WAN address - which they get from the DHCP behind the Nat (and not the real IP).
So the right way is to configure WAN port statically or bind WAN interface to fixed IP via dhcpd.
And next, some throughput table with my settings (somehow same for all the tested devices):
Device IPSEC/IKE1 throughput, as wget shows,kilo/megaBYTEs
D-Link HV808 540 KB/s (0.5 megabits/sec)
ZyWALL 30W 1.28 MB/s
ZyWALL 2 2.15 MB/s
D-Link DFL-860E 6.36 MB/s (note: the wire itself if 70Mbs)
pppd over ssh, without hardware router (one side - banana PI, other is i7?)
IPv4 1,05MB/s
IPv6 962KB/s
Direct wget over IPv4, for line testing 9,64MB/s (but ISP says I have 70Mbs) Direct wget over IPv4 via DI-808HV, Wan is DHCP ~5.4MB/s
Those devices are really antique (except DFL-860), but that's what I have to share.
I was not able to test D-Link DFL-100 and ASUS SL1000 because they are unable to do XAuth as client.

Friday, December 7, 2018

Compex SRX1224


Some notes on Compex SRX1224 switch.
You plug an null modem cable there, and it does not work? Right?
That's easy. You need the straight, non-null-modem cable! And you need some DB9F-to-DB9F direct converter.
As for switch itself, it is 100Mbs switch, managed from console only, without 802.1Q, just port switch.
UPD: also, for the Nortel/Baystack 325 and 425, you need straight cable, too. But it's a very different device, full of vlans and other useful features.