Archive for the ‘kludges’ Category

openssl and digital envelope routines:EVP_DecryptFinal_ex:bad decrypt:../crypto/evp/evp_enc.c:536 error

Tuesday, January 8th, 2019

If You used an old openssl to encrypt a file, e.g. openssl 1.0.x with some command line such as:

$ openssl enc -in <plain input file> -out <crypted output file> -e -des-ede3-cbc

decrypting it using a newer openssl release You will find a similar error:

$ openssl enc -in <plain input file> -out <crypted output file> -d -des-ede3-cbc

bad decrypt
140109197936000:error:06065064:digital envelope routines:EVP_DecryptFinal_ex:bad decrypt:../crypto/evp/evp_enc.c:536:

despite this mismatch error, it’s possible to obtain the original plain file adding the -md md5  option in the decrypt command:

$ openssl enc -in <plain input file>  -md md5   -out <crypted output file> -d -des-ede3-cbc

running more than a single telegram desktop client

Tuesday, August 2nd, 2016

I installed the Telegram Desktop client, and next I created a new folder named “C:\Users\myname\AppData\Roaming\Telegram Desktop\tdata_another”.

Then I added  telegram.exe path in the PATH environment variable. This step is not mandatory but I’d rather to write “telegram” instead of “C:\Users\myname\AppData\Roaming\Telegram Desktop\telegram” in the next step.

Finally, to run two telegram instances, from the DOS prompt I wrote

C:\Users\myname>Telegram -many -workdir “C:\Users\myname\AppData\Roaming\Telegram Desktop\tdata”

followed by

C:\Users\myname>Telegram -many -workdir “C:\Users\myname\AppData\Roaming\Telegram Desktop\tdata_another”

Don’t ask me, I don’t know why…

Friday, February 7th, 2014

I’m telling You about a Centos 5.10 server joined to an Active Directory environment.
Once I was able to open a ssh session on this server with my A.D. username/password, but some day ago I noticed it was possible only to log in this server using local root account.
I discovered that the wbinfo -i myusername  command retuned a WBC_ERR_WINBIND_NOT_AVAILABLE error.

To fix this problem I issued the following commands:

  # service winbind stop
  # service smb stop
  # net cache flush
  # rm -f /var/lib/samba/*tdb
  # service smb start
  # service winbind start

How to remove the read failed after 0 of 4096 I/O error

Wednesday, September 18th, 2013

Recently in a very old server I had to remove a disk. My server was composed by two physical volumes: a RAID5 volume, shown as /dev/sda  to the operating system  by the SCSI controller, and a single hard disk as /dev/sdb.

My /dev/sdb, since there is no way to have a new disk with the same geometry, I decided to remove it.
The bios utility of my SCSI controller is quite strange and I cannot remove my une-disk logical volume without remove all the configuration.

root@arch:~# pvdisplay
  /dev/sdb: read failed after 0 of 4096 at 0: input/output Error
  /dev/sdb: read failed after 0 of 4096 at 146695716864: input/output Error
  /dev/sdb: read failed after 0 of 4096 at 146695774208: input/output Error
  /dev/sdb: read failed after 0 of 4096 at 4096: input/output Error
  — Physical volume —
  PV Name               /dev/sda1
  VG Name               vg_system
  PV Size               838,12 GiB / not usable 2,00 MiB
  Allocatable           yes
  PE Size               4,00 MiB
  Total PE              214559
  Free PE               21184
  Allocated PE          193375
  PV UUID               ZQQwAs-yGgP-LZXk-3cTy-yaOb-gijr-bnUCz4

So I’d better to leave my controller untouched and tell my linux CentOS to forget the /dev/sdb disk.

root@arch:~# echo 1 > /sys/block/sdb/device/delete

a self-made log statistics with wordpress

Tuesday, August 14th, 2012

It’s not the case of freeshell.de or nic-nac-project.de that kindly is hosting this blog, but in the world there are some low cost hosting profiles where You can’t access your weblog.
Several times the webserver logs nothing at all.
Since I think  it’s a nice thing to have my web access statistics, if Your wordpress blog is on such kind of webserver, I suggest to add some plugin to your wordpress installation, such as myStat.

Once I preferred to write my own the http access log, in order to process it with awstats.
To do this, I changed the footer.php of my wordpress theme adding theese lines after the </html> tag:

<?php wp_footer(); ?>
</body>
</html>
<?php
// kludge to write a sort of access log on a file….
$monthyear = date(“F-Y”);
$remoteip = getenv(‘REMOTE_ADDR’);
$mytimestamp = date(“d/M/Y:G:i:s T”);
$useragent= getenv(“HTTP_USER_AGENT”);
$requri= getenv(“REQUEST_URI”);
$reqmet= getenv(“REQUEST_METHOD”);
$referrer= getenv(“HTTP_REFERER”);
$docroot= getenv(“DOCUMENT_ROOT”);
$logdir= $docroot . “/bloglog”;
$fplog = fopen($logdir .”/accesslog-myblog-“.$monthyear.”.txt”, “a+”);
fprintf ($fplog, “%s – [%s] \”%s %s\” \”%s\” \”%s\” 200\n”,
$remoteip, $mytimestamp,
$reqmet, $requri,
$useragent, $referrer);
fclose ($fplog);
?>

Doing so, a web access to any page of my site will add a log line into the accesslog-myblog-August-2012.txt  file. This file is into a directory named bloglog at the root of the webpages.

Getting this file and putting it on a linux box with awstats installed, it’s easy to generate my web statistics.

 

First I have to create a /etc/awstats/awstats-myblogname.conf telling my LogFile path and my LogFormat

LogFormat = “%host – %time1 %methodurlnoprot %uaquot %refererquot %code”

Then I have to run

 /usr/share/awstats/tools/awstats_updateall.pl now         -configdir=”/etc/awstats”         -awstatsprog=”/usr/share/awstats/wwwroot/cgi-bin/awstats.pl”

in order to read my stats at http://my-awstats-server.local/awstats/awstats.pl?config=myblogname

A sort of diff implementation in the MS-DOS world

Thursday, July 7th, 2011

The MS-DOS FC.EXE programs is useful to compare two files. Differences between files are shown introduced by the string “*****” otherwise, if the files are equal, no asterisks will are displayed.
Redirecting the output on a temporary file, using SET /P it’s possible to define a variable in order to handle both the cases (the files are different or the files are equals).

A sort of *nix diff implementation made by a batch script may be the following:

@echo off
fc %1 %2|find /c “*****” > tempfile.out
SET /P TestVar=<tempfile.out
del tempfile.out
echo TestVar=%TestVar%
if %TestVar% == 0 GOTO:FEQUALS
echo %1 and %2 are different
GOTO:EOF
:FEQUALS
echo %1 and %2 are equals

Off corse if You need something better of this silly diff version, You may find useful djcpp, cygwin or other unix-like platforms

compiling clam-av 0.96.3 in an old linux system

Wednesday, September 22nd, 2010

If for some reason You are trying to compile clamav-0.96.3 in an old linux system (e.g. a Debian sarge with a 3.3.5 gcc version) You will get a “compiler too old” error.
I know it is a kludge, but it’s possible to ent the compilation process in two steps.
first, opet the ./clamav-0.96.3/libclamav/c++/configure file and disable the line

as_fn_error “C++ compiler too old (${gxx_version})” “$LINENO” 5

e.g. writing [02].*) instead of [023].*) in the previous line.
second, run the main ./configure script disabling llvm.

./configure –disable-llvm

Then run make and make install as usual.

No such directory error calling lynx in a shell script

Monday, June 14th, 2010

Some time ago I was testing a shell script nagios plugin. Running this script from command line was ok, but once called from nagios scheduling, the plugin standard error was

/root/: No such directory

Due to some little problem (is this a lynx problem?)  I needed to set the HOME environment variable before calling lynx.

MYSTR=`export HOME=/tmp && /usr/bin/lynx -dump “http://$MYHOST/$MYURL?MYFILTER=$MYPARAM”`