-1

I'm trying to do encryption in Expect as outlined in this wiki on Ubuntu 16.04. I've installed tcllib

root@alarmux:/home/abdmin# apt-get install tcllib
Reading package lists... Done
Building dependency tree       
Reading state information... Done
tcllib is already the newest version (1.17-dfsg-1).
0 upgraded, 0 newly installed, 0 to remove and 77 not upgraded.

However, when I run my script I get:

couldn't execute "des": no such file or directory
    while executing
"exec echo "$pd" | des -e -k $key -b > /home/abdmin/$filename"
    (procedure "utility_encrypt" line 3)
    invoked from within
"utility_encrypt pswd encrypted_Pass"
    (file "./tclTest" line 22)

Why can't the des command be executed?

  • 3
    you need to install "des" command – francois P Nov 14 '18 at 19:31
  • Did you read the documentation for the tcllib des package? – glenn jackman Nov 14 '18 at 20:14
  • That document's content is 13 years old. Encryption has moved on a very long way in that time. Don't use DES; it's crackable in seconds (or less). – roaima Nov 15 '18 at 8:41
  • @roaima I know :) I just want to avoid having plaintext passwords in my script to avoid over-the-shoulder reading. – KuboMD Nov 15 '18 at 12:55
  • Encryption for the TCL script itself? Or are you using the TCL just to generate encrypted/decrypted passwords for a more complex shell script? – roaima Nov 15 '18 at 13:34
0

As mentioned in a comment, if all you want to do is to avoid shoulder-surfing for cleartext passwords you can use a trivial encoding. For example, here's one in Perl

# Generate encoding
echo secret123 | perl -e 'chomp($passwd=<>); chomp($encoded=pack("u",$passwd));print "$encoded\n"'
)<V5C<F5T,3(S

Here the encoded password for secret123 is )<V5C<F5T,3(S.

# Restore cleartext
echo ')<V5C<F5T,3(S' | perl -e 'chomp($encoded=<>); chomp($passwd=unpack("u",$encoded)); print "$passwd\n"'
secret123
  • Thank you! I'll give this a try. Should I apt install perl first? – KuboMD Nov 15 '18 at 13:47
  • I'd be surprised if you didn't have a basic install already. Failing that I can put an encoder together in shell script – roaima Nov 15 '18 at 13:49
  • OK, I'll give it a go! My plan is to encode my password just once and say the encoded file. The script can decode as necessary without anyone seeing the plaintext. Thank you for this. – KuboMD Nov 15 '18 at 13:52
  • 1
    I suppose base64 would work as well, or even just rot13. – Kusalananda Nov 15 '18 at 14:23
1

That page lists multiple solutions, so you'll need to use only one of them, or something else, depending on exactly what you're trying to do.

  1. The des command code relies on some external binary called des. This command is not provided by TCL, nor by tcllib. It may be something ancient once used for (old, bad, insecure) DES or 3DES encryption. You will need to find the des command or use something compatible.
  2. tcllib does provide a des(n) interface, but that does not appear to be documented on the page you linked. DES is, again, very weak and very old.
  3. tcllib does provide a md5crypt(n) interface which is mentioned on the page you linked.

Something like PGP or bcrypt or scrypt may be better options over the DES or MD5 crypt algorithms, though it's not clear what problem you are trying to solve...do you need DES for compatibility with something ancient? How exactly are these secrets being used?

0

You can get the file list of the tcllib package for Ubuntu 16.04 here on packages.ubuntu.com, it doesn’t contain a file like /usr/bin/des which you’re trying to run – and neither does any other package from the official repos. The only alternative I see is to download the software and (after purging the tcllib package) compile it yourself as explained here: How do I install a .tar.gz (or .tar.bz2) file?

  • Thank you. I didn't realize that the support for des had essentially been dropped. I'll explore other options. – KuboMD Nov 15 '18 at 12:58
  • @KuboMD You’re welcome! If this answer solved your issue, please take a moment and accept it by clicking on the check mark to the left. That will mark the question as answered and is the way thanks are expressed on the Stack Exchange sites. – dessert Nov 15 '18 at 13:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.