Xerox Phaser 3052 against Debian Linux – shell wins, admin loses

Installing a printer in Linux should not be a challenge nowadays… It shouldn’t, should it? Shoot it, it shouldn’t.

I have this wonderful Xerox Phaser 3052 that works beautifully and I had to get it working with my new Linux notebook. I vaguely remembered that when I was installing it for my old notebook the procedure was not very despicable, so I was full of high hopes and thought I would be printing away in a few minutes. It works for the old one, right? Well, whaddayaknow, two days later I have a simple install procedure that works and a desire to strangle a few Xerox and Debian developers.

The necessary filters and all that (driver package) are available at Xerox Driver download for Phaser 3052 and that is wonderful. Simply download that and then load also the Debian package for the Phaser 3010-3040 driver.

Unpack the second one and marvel at the i386 architecture .deb package. Now, of course, we are running a 64 bit architecture, so we will have to add the i386 to be able to use that. Fortunately, that is simple:

dpkg --add-architecture i386
apt-get update
apt-get install libcups2:i386
apt-get install ./xerox-phaser-3010-3040_1.0-28_i386.deb

It should all work like a charm. Now we have to install the filters. Unpack the first package and change into the “uld” directory. If you now try to run install-printer.sh, you will be not surprised that it doesn’t work.

# ./install-printer.sh 
**** Running install ...
**** Press 'Enter' to continue or 'q' and then 'Enter' to quit. : 
./noarch/package_install.sh: 57: local: 3052/uld/noarch/.version-printer: bad variable name
**** Install finished.

Spending a long evening trying to figure out what is wrong with the script did not help. Fortunately, in the morning I was a little brighter and suddenly decided to check what shell the scripts are running with. And, damn, it isn’t bash.

# l /bin/sh
lrwxrwxrwx 1 root root 4 Jan 24  2017 /bin/sh -> dash*

There is a little what’s it in the fact that all scripts are written for bash and the Debian developers decided that switching to dash would be a bright idea. No, really? Ok, now the fix is obvious and simple:

# cd /bin/
# rm sh
# ln -s bash sh

And suddenly, like if by magic, it all works…

# ./install-printer.sh 
**** Running install ...
**** Press 'Enter' to continue or 'q' and then 'Enter' to quit. : 
**** Are you going to use network
--> continue reading →

Getting email off your Linux server with ssmtp and yandex

A quick note to self about configuration of servers with ssmtp and yandex mail service (any other would work too, of course). I keep forgetting how it is done and keep spending time looking about so here goes the summary.

Install ssmtp package, if missing, install also bsd-mailx.

Configuration for ssmtp goes into /etc/ssmtp/ssmtp.conf

MailHub=smtp.yandex.ru:587 # Provider SMTP server hostname and port
UseStartTLS=YES # Secure connection (SSL/TLS)
FromLineOverride=YES # Force the From: line
Hostname=example.com # The name of this host
RewriteDomain=example.com # The host the mail appears to be coming from
Root=webmaster@example.com # Redirect mail for root@ to webmaster@example.com
AuthUser=webmaster@example.com # Provider mail account
AuthPass=password # The password for the mail account

Note that it is not UseTLS anymore but UseStartTLS, otherwise you’ll get

May 25 18:47:18 example sSMTP[315]: Creating SSL connection to host
May 25 18:47:18 example sSMTP[315]: SSL connection using (null)
May 25 18:47:18 example sSMTP[315]: Cannot open smtp.yandex.ru:587

Now all of the accounts that send email must be mentioned in the /etc/ssmtp/revaliases file and be mapped to this existing account at the provider:

root:webmaster@example.com:smtp.yandex.ru
www-data:webmaster@example.com:smtp.yandex.ru
cron:webmaster@example.com:smtp.yandex.ru

Now we have a working configuration but the password for the service is exposed in a world-readable config file. To fix that, we create a new group:

groupadd ssmtp

Change the ownership of both the config file and the sSMTP binary to this group:

chown :ssmtp /etc/ssmtp/ssmtp.conf

chown :ssmtp /usr/sbin/ssmtp

Set the SGID bit for the binary so that others invoking it get the proper permissions:

chmod g+s /usr/sbin/ssmtp

And restrict the permissions of the config file:

chmod 640 /etc/ssmtp/ssmtp.conf

Now everything should work like a charm… unless I forgot something again :)… -->

continue reading →