FreeBSD: SSL: CERTIFICATE_VERIFY_FAILED


Sometimes, when installing some python module with pip or easy_install the following error arises:

 

[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed

In FreeBSD 10.1 it can be quickly fixed doing:

pkg install ca_root_nss-3.17.3_1

ln -s /usr/local/share/certs/ca-root-nss.crt /etc/ssl/cert.pem

Posted in BSD, FreeBSD | 1 Comment

FreeBSD: Calibre Patch for Sony Ebook Reader PRS-T3


Probably this patch works for others ebook readers, but only has been tested with Sony PRS-T3.

There is a thread about a hacking Calibre for a Kobo Aura HD in:

http://www.mobileread.com/forums/archive/index.php/t-244555.html

but this method didn’t work with my device.

My solution is to modify this file:

/usr/local/lib/calibre/calibre/devices/usbms/device.py

with the following patch:

http://pastebin.com/embed_iframe.php?i=uv2JNP1P

Unfortunately, Calibre in FreeBSD rarely is able to unmount the device (mine is mounted as /media/Calibre-READER). This produce a failure mounting the PRS-T3 next time it’s attached. My ugly solution is to add a rule to devd.conf to umount the device and delete the mount point directory in order to prepare a clean mounting next time the device is attached.

So, add the following rule to /etc/devd.conf:

notify 100 {
        match “system”          “USB”;
        match “subsystem”       “DEVICE”;
        match “type”            “DETACH”;
        match “vendor”          “0x054c”;
        match “product”         “0x05c2″;
        #match “release”         “0x0100″;
        action  “logger Unmount vendor:$vendor product:$product ; /sbin/umount -f /media/Calibre* ; rm -fR /media/Calibre*”;
};

Obviosly, replace vendor and product if needed.

Then restart devd and test it.

/etc/devd restart

If someone finds out a more elegant way to mount/umount a Sony PRS-T1/2/3 in Calibre, please, let me know.

Posted in BSD, FreeBSD | Leave a comment

FreeBSD: NFS automount with AutoFS


This applies only to FreeBSD 10.1 and newer. Previous FreeBSD releases must use amd.

Personally, I dislike ‘amd’. Its configuration is a bit complex. Autofs configuration is pretty simple.

I want to automount 2 folders from my ReadyNas Duo:

192.168.0.14:/media
192.168.0.14:/backup

First, enable autofs:

/etc/rc.conf:

#AUTOFS
autofs_enable=”YES”

Next, edit /etc/auto_master pointing to the map file with the folders to automount:

/etc/auto_master:

#NFS
/mnt/nas        /etc/auto.nas

Take note ‘/mnt/nas’ is the point where the folders will be mounted.

Then create a file with the map:

/etc/auto.nas:

media -intr,nfsv3 192.168.0.14:/media
backup -intr,nfsv3 192.168.0.14:/backup

Finally start autofs:

service start automount

service start automountd

service start autounmountd

In a terminal or file browser go to /mnt/nas/media and /mnt/nas/backup to check if autofs works.

Posted in BSD, FreeBSD | Leave a comment

OpenBSD: phpMyAdmin and NGINX


We will suppose MySQL is already installed.

# pkg_add php-fpm php-mysql phpmyadmin

 In /etc/rc.conf.local:

nginx_flags=""
pkg_scripts="mysqld php_fpm"
 # cp -fR /var/www/phpMyAdmin to /var/www/htdocs

Add to /etc/nginx/nginx.conf:

#PHP
location / {
     root   /htdocs;
     index  index.html index.htm index.php;
 }
location ~ \.php$ {
     try_files      $uri $uri/ =404;
     fastcgi_pass   unix:run/php-fpm.sock;
     fastcgi_index  index.php;
     fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
     include        fastcgi_params;
 }
location /phpmyadmin/ {
     root   /htdocs;
     index  index.html index.htm index.php;
 }
location ~ ^/phpmyadmin/\.php$ {
     try_files      $uri $uri/ =404;
     fastcgi_pass   unix:run/php-fpm.sock;
     fastcgi_index  index.php;
     fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
     include        fastcgi_params;
 }

Make a file ‘/var/www/htdocs/phpinfo.php with the following lines:

<?
php phpinfo();
?>

Start nginx and php_fpm:

/etc/rc.d/php_fpm start
/etc/rc.d nginx start

Test the PHP installation with your browser pointing to ‘localhost/phpinfo.php’. If a page with information about your PHP installation then nginx is executing php code. If what you see is php code then nginx is serving PHP pages as plain text (review your nginx configuration).

 

If nginx is executing PHP code then you can try phpMyAdmin, pointing your browser to:

 

http://localhost/phpmyadmin/index.php

A good article as reference:

http://www.h-i-r.net/p/openbsd.html

Posted in BSD, OpenBSD | Leave a comment

OpenBSD: connection problems with some sites in internet


I’m experiencing some problems when trying to connect, via web browser, with some sites as ebay or google. I’ve discovered that I get a better experience browsing when the MTU in the wifi interface (iwn0) is lower than 1500. So I put in /etc/hostname.iwn0:

 

mtu 1440 up

This is a very odd thing. MTU path discovery is permitted in my firewall configuration (icmp_types = “{ echoreq, unreach }”) and even deactivating PF the problems remain.

 

Posted in Uncategorized | Tagged , | Leave a comment

OpenBSD: hibernation rules!!!!


Simply great! hibernation in i386 works great!. It seems it could be there some issues but in my experience is pretty usable.

This is the first time I’m able to see hibernation working in a BSD laptop since my Thinkpads T20, T23 and T41 with their bios solution with a dedicated partition. So well done OpenBSD.

 

Posted in BSD, OpenBSD | Leave a comment

OpenBSD: How to avoid resolv.conf to be touched by dhclient


I prefer to provide DNS address of my choice instead those from my network provider. Usually OpenDNS servers are a good option.

So, to avoid dhclient touch ‘/etc/resolv.conf’ I configure the /etc/dhclient.conf as follows:

initial-interval 1;
send host-name “myhostname”;
#request subnet-mask, broadcast-address, routers, domain-name,
#       domain-name-servers, host-name;
#send dhcp-lease-time 3600;
supersede domain-name-servers 208.67.222.222, 208.67.220.220 ;
supersede domain-name “”;
request subnet-mask, broadcast-address, routers;

And /etc/resolv.conf.tail :

lookup file bind

 

Posted in BSD, OpenBSD | Leave a comment