newspaint

Documenting Problems That Were Difficult To Find The Answer To

Monthly Archives: October 2015

Tmux Value Is Invalid

I created a .tmux.conf file but tmux kept rejecting the settings I put in the file with the error:

value is invalid

The cause? I created the configuration file in in Windows using the DOS end-of-line encoding instead of Unix end-of-line encoding.

Tenvis TH692 IP/Network Camera

Resources

To reset the camera press and hold the push button for 15 seconds.

For URLs see http://www.instar.com/faq_cgi_hd.

For the CGI interface (of more interest to programmers) see the PDF at http://wiki.instar.com/index.php/File:INSTAR_CGI_H264_Chipset_English.pdf.

Out of the Box

Your router should dynamically assign a DHCP address to the camera by default (out of the box) and the camera will report itself with “IPCAM” as the hostname.

You can log into the camera by visiting http://<address>/ using the username admin and password admin which you’ll have to change on first login.

Feeds

You can get a video feed in VLC from your camera by using the following URL:

  • rtsp://admin:password@<address>:554/1 (1024×768)
  • rtsp://admin:password@<address>:554/2 (640×352)

You can take a temporary snapshot photo:

iPhone Quicktime stream:

Altering Video Feed Parameters

By default the camera is set to transmit at 2048Kbps and 25 frames per second. If you’re trying to upload that stream over a home Internet connection that can be a little excessive. Perhaps you’re happier with 5 frames per second and 512Kbps. How can you set this? The user interface on the web camera will only let you change the frame rate – not the bit rate.

The URL http://<address>/web/cgi-bin/param.cgi?cmd=getvencattr&-chn=1 will fetch the parameters of the connection and will look like this:

var bps_1="2048"; var fps_1="25"; var gop_1="25"; var brmode_1="1"; var imagegrade_1="1"; var width_1="1280"; var height_1="720"; 

You can set parameters (see PDF link above) such as:

Other parameters include:

  • gop – prime frame rate interval (2-150)
  • imagegrade – encode quality (1-6), lower values better image quality
  • brmode – 0 for fixed bit rate, 1 for variable bit rate

Setting Infrared Mode

The URL http://<address>/web/cgi-bin/param.cgi?cmd=getinfrared will get the current state of the infrared mode and return:

var infraredstat="auto";

To set the infrared mode you have the choice of:

Compiling/Installing ZoneMinder on Ubuntu Trusty 14.04 From Source

Download ZoneMinder

Download from http://www.zoneminder.com/downloads.

sudo apt-get install wget
wget 'https://github.com/ZoneMinder/ZoneMinder/archive/v1.28.1.tar.gz'
tar -xvzf v1.28.1.tar.gz

Build

Find required packages at http://packages.ubuntu.com/.

sudo apt-get install autoconf automake
sudo apt-get install libmariadbclient-dev
sudo apt-get install libpolkit-gobject-1-0 libpolkit-gobject-1-dev
sudo apt-get install g++
sudo apt-get install libjpeg62 libjpeg62-dev
sudo apt-get install libgnutls-dev
sudo apt-get install libdbi-perl libdbd-mysql-perl libdate-manip-perl libwww-perl libsys-mmap-perl
sudo apt-get install libavutil-dev libavcodec-dev libavformat-dev libavdevice-dev
sudo apt-get install libswscale-dev libbz2-dev libx264-dev
sudo apt-get install netpbm libvlc-dev
sudo apt-get install libarchive-zip-perl libmime-lite-perl

Then configure.

./bootstrap.sh
./configure --with-webdir=/opt/zm/web/zm --with-cgidir=/opt/zm/web/cgi --with-webuser=www-data --with-webgroup=www-data --prefix=/opt/zm --with-libarch=lib

Next make.

sudo apt-get install make
nice make -j 2

Was receiving the build error:

./configure: line 3430: syntax error near unexpected token `POLKIT,'
./configure: line 3430: `PKG_CHECK_MODULES(POLKIT, polkit-gobject-1)'

Solution was to sudo apt-get install libpolkit-gobject-1-0 libpolkit-gobject-1-dev and ./bootstrap.sh again.

Install.

sudo make install
sudo mkdir /opt/zm/share/perl
sudo ln -s '/opt/zm/share/perl5/' '/opt/zm/share/perl/5.18.2'

Then set up database.

sudo apt-get install mariadb-client mariadb-server
echo "create database zm" |mysql -u root -p

Add to my.cnf as per this MySQL webpage and this MariaDB webpage:

[mysqld]
innodb_file_per_table=1
innodb_file_format=Barracuda

Then:

mysql -u root -p zm < /opt/zm/share/zoneminder/db/zm_create.sql
echo "grant select,insert,update,delete,lock tables,alter on zm.* to 'zmuser'@localhost identified by 'zmpass'" |mysql -u root -p

Now we need a lock directory:

sudo mkdir /var/lock/subsys

Then we need an init script:

Create /etc/init.d/zm from this ZoneMinder webpage.

Apache

sudo apt-get install apache2-mpm-worker

And, as recommended by this forum post for PHP5 CGI:

sudo apt-get install libapache2-mod-fcgid
sudo apt-get install php5-cgi php5-cli php5-mysqlnd

Enable SSL and CGI modules:

sudo mkdir /etc/apache2/ssl
a2enmod ssl
a2enmod cgi
sudo mkdir /var/log/apache2/zm/

And for basic authentication (to run htpasswd in Ubuntu) you need to:

sudo apt-get install apache2-utils # for htpasswd

A configuration that can be placed in /etc/apache2/sites-available is:

<IfModule mod_ssl.c>
  <VirtualHost _default_:443>
    ServerAdmin webmaster@localhost

    DocumentRoot /opt/zm/web/zm

    ErrorLog /var/log/apache2/zm/error.log
    CustomLog /var/log/apache2/zm/access.log combined

    #   SSL Engine Switch:
    #   Enable/Disable SSL for this virtual host.
    SSLEngine on

    # You're going to have to create your own PEM file
    SSLCertificateFile /etc/apache2/ssl/apache.pem
    <FilesMatch "\.(cgi|shtml|phtml|php)$">
      SSLOptions +StdEnvVars
    </FilesMatch>
    <Directory /opt/zm/web/cgi>
      SSLOptions +StdEnvVars
    </Directory>

    BrowserMatch "MSIE [2-6]" \
      nokeepalive ssl-unclean-shutdown \
      downgrade-1.0 force-response-1.0 
    BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown

    <Directory /opt/zm/web/zm>
      <IfModule mod_authz_core.c>
        # Apache 2.4
        Require all granted
      </IfModule>
      <IfModule !mod_authz_core.c>
        # Apache 2.2
        Order deny,allow
        Allow from all
      </IfModule>

      AddHandler fcgid-script .php
      FCGIWrapper /usr/lib/cgi-bin/php5 .php
      Options +ExecCGI +Indexes

      AllowOverride All
    </Directory>

    ScriptAlias /cgi-bin/ /opt/zm/web/cgi/
    <Directory /opt/zm/web/cgi>
      Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
      AllowOverride All
      <IfModule mod_authz_core.c>
        # Apache 2.4
        Require all granted
      </IfModule>
      <IfModule !mod_authz_core.c>
        # Apache 2.2
        Order deny,allow
        Allow from all
      </IfModule>

      <FilesMatch "(nph-zms|zms)">
        SetHandler cgi-script
        SSLOptions +StdEnvVars
       </FilesMatch>
    </Directory>

    <Directory />
      <IfModule mod_authz_core.c>
        # Apache 2.4
        Require all denied
      </IfModule>
      <IfModule !mod_authz_core.c>
        # Apache 2.2
        Order deny,allow
        Deny from all
      </IfModule>
    </Directory>
  </VirtualHost>
</IfModule>

Linux Citrix Client – Black Screen on Connection

I was using the Citrix Linux Client/Receiver 13.2.1. But whenever I started a Citrix session (to a Windows virtual desktop) I would see the small log-in dialog, which I’d successfully fill out, but then the display would take up the full-screen and would be black.

As a work-around I could select the session from the session manager taskbar, right click on it, and select move – and the action of moving the window would cause it to display as normal. But this was frustrating – having to move the window every time to make it display – and once moved it would no longer be full screen but have scroll bars on the bottom and right-hand side.

A solution to this is to start the session with a command line parameter (-geometry widthxheight) added to the wfica executable. For example, on a 1920×1200 display the following settings would set up a separate application window with the remote desktop session inside:

./wfica -geometry 1860x1160 -file $1

Command line arguments for wfica are available at the Citrix website.

Linux Citrix Receiver – AuthManagerDaemon Not Found Running configmgr

When running /opt/Citrix/ICAClient/util/configmgr it would take tens of seconds to update the display and the console would output the following messages:

AuthManagerDaemon not found
ServiceRecord daemon not found

A thread recommended running /opt/Citrix/ICAClient/selfservice to see what was missing, on Ubuntu 14.04 it reported:

./selfservice: error while loading shared libraries: libsoup-2.4.so.1: cannot open shared object file: No such file or directory
libwebkit: libwebkit-1.0.so.2: cannot open shared object file: No such file or directory

So I ran:

sudo apt-get install libsoup2.4-1

And then configmgr would work again.

Linux Citrix Receiver – SSL Error – AddTrust External CA Root

I received the following error after installing the Citrix Receiver for Linux:

SSL error
Contact your help desk with the following information: You have not chosen to trust “AddTrust External CA Root”, the issuer of the server’s security certificate (SSL error 61).

Error message about AddTrust External CA Root

Error message about AddTrust External CA Root

One recommendation is to copy all the certificates from Mozilla’s certificate store to the Citrix store:

cp /usr/share/ca-certificates/mozilla/* /usr/lib/ICAClient/keystore/cacerts/
cp /usr/share/ca-certificates/mozilla/* /opt/Citrix/ICAClient/keystore/cacerts/

But I chose to download addtrustexternalcaroot.crt from Comodo into /opt/Citrix/ICAClient/keystore/cacerts/ and attempt the connection again – this worked for me; alternatively you can copy the following text into a file in the same path:

-----BEGIN CERTIFICATE-----
MIIENjCCAx6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBvMQswCQYDVQQGEwJTRTEU
MBIGA1UEChMLQWRkVHJ1c3QgQUIxJjAkBgNVBAsTHUFkZFRydXN0IEV4dGVybmFs
IFRUUCBOZXR3b3JrMSIwIAYDVQQDExlBZGRUcnVzdCBFeHRlcm5hbCBDQSBSb290
MB4XDTAwMDUzMDEwNDgzOFoXDTIwMDUzMDEwNDgzOFowbzELMAkGA1UEBhMCU0Ux
FDASBgNVBAoTC0FkZFRydXN0IEFCMSYwJAYDVQQLEx1BZGRUcnVzdCBFeHRlcm5h
bCBUVFAgTmV0d29yazEiMCAGA1UEAxMZQWRkVHJ1c3QgRXh0ZXJuYWwgQ0EgUm9v
dDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALf3GjPm8gAELTngTlvt
H7xsD821+iO2zt6bETOXpClMfZOfvUq8k+0DGuOPz+VtUFrWlymUWoCwSXrbLpX9
uMq/NzgtHj6RQa1wVsfwTz/oMp50ysiQVOnGXw94nZpAPA6sYapeFI+eh6FqUNzX
mk6vBbOmcZSccbNQYArHE504B4YCqOmoaSYYkKtMsE8jqzpPhNjfzp/haW+710LX
a0Tkx63ubUFfclpxCDezeWWkWaCUN/cALw3CknLa0Dhy2xSoRcRdKn23tNbE7qzN
E0S3ySvdQwAl+mG5aWpYIxG3pzOPVnVZ9c0p10a3CitlttNCbxWyuHv77+ldU9U0
WicCAwEAAaOB3DCB2TAdBgNVHQ4EFgQUrb2YejS0Jvf6xCZU7wO94CTLVBowCwYD
VR0PBAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wgZkGA1UdIwSBkTCBjoAUrb2YejS0
Jvf6xCZU7wO94CTLVBqhc6RxMG8xCzAJBgNVBAYTAlNFMRQwEgYDVQQKEwtBZGRU
cnVzdCBBQjEmMCQGA1UECxMdQWRkVHJ1c3QgRXh0ZXJuYWwgVFRQIE5ldHdvcmsx
IjAgBgNVBAMTGUFkZFRydXN0IEV4dGVybmFsIENBIFJvb3SCAQEwDQYJKoZIhvcN
AQEFBQADggEBALCb4IUlwtYj4g+WBpKdQZic2YR5gdkeWxQHIzZlj7DYd7usQWxH
YINRsPkyPef89iYTx4AWpb9a/IfPeHmJIZriTAcKhjW88t5RxNKWt9x+Tu5w/Rw5
6wwCURQtjr0W4MHfRnXnJK3s9EK0hZNwEGe6nQY1ShjTK3rMUUKhemPR5ruhxSvC
Nr4TDea9Y355e6cJDUCrat2PisP29owaQgVR1EX1n6diIWgVIEM8med8vSTYqZEX
c4g/VhsxOBi0cQ+azcgOno4uG+GMmIPLHzHxREzGBHNJdmAPx/i9F4BrLunMTA5a
mnkPIAou1Z5jJh5VkpTYghdae9C8x49OhgQ=
-----END CERTIFICATE-----

VeriSign Class 3 Public Primary Certification Authority – G5

If the message you get it very similar except that it says:

SSL error
Contact your help desk with the following information: You have not chosen to trust “VeriSign Class 3 Public Primary Certification Authority – G5”, the issuer of the server’s security certificate (SSL error 61).

Then you can obtain the certificate from this link or otherwise copy it directly from the following into a file named /opt/Citrix/ICAClient/keystore/cacerts/VeriSign_Class_3_Public_Primary_Certification_Authority_G5.crt and retry starting your Citrix session:

-----BEGIN CERTIFICATE-----
MIIE0zCCA7ugAwIBAgIQGNrRniZ96LtKIVjNzGs7SjANBgkqhkiG9w0BAQUFADCB
yjELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQL
ExZWZXJpU2lnbiBUcnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJp
U2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxW
ZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0
aG9yaXR5IC0gRzUwHhcNMDYxMTA4MDAwMDAwWhcNMz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