Installing Citrix Workplace on Ubuntu Linux

Installation

$ cd Downloads
$ sudo dpkg -i Citrix-Workspace.deb

Installing a CA Certificate

The pre-installed certificates might work for you. If you get errors when trying to use Citrix, then you’ll likely need to install a CA certificate.

  • Go to the VPN website you use Citrix for.
  • Click on the lock in front of the url
  • Click on certificate (Chrome) or Connection Secure (Firefox)
  • Note the authority under Issued By (Chrome) or Verified By (Firefox)
  • For example, the certification authority might be: DigiCert TLS RSA SHA256 2020 CA1
  • Search for DigiCert TLS RSA SHA256 2020 CA1 in your favorite search engine.
  • Select the official site that allows you to download the relevant certificates.
  • Download both the PEM and the CRT files.
  • Do the following:
$ sudo cp ~/Downloads/DigiCertTLSRSASHA2562020CA1-1.pem /opt/Citrix/ICAClient/keystore/cacerts
$ sudo chmod 644 /opt/Citrix/ICAClient/keystore/cacerts/DigiCertTLSRSASHA2562020CA1-1.pem
$ sudo /opt/Citrix/ICAClient/util/ctx_rehash

Note: The instructions on the Citrix website seem to be incorrect. It tells you to cp the pem file with a crt extention, even though every other file in the directory is a PEM file. The above copies to the default Citrix directory on Ubuntu, changes the file permissions to -rw-r–r–, and rehashes the new certificate so Citrix can use it.

X.509 Certificate for Chrome or Firefox Browsers

I’m not sure if this is strictly necessary, but it might also be helpful to import the X.509 certificate into Chrome or Firefox. For Chrome (Firefox is similar), do the following:

  • Go to the three dots (hamburger)
  • Select Chrome settings
  • Search for: certificate
  • Click on Security
  • Click on Manage Certificates
  • Click on Authorities
  • Click on Import
  • Select ~/Downloads/DigiCertTLSRSASHA2562020CA1-1.crt
  • Select all three options.

bash: TOTP From the Terminal With oathtool

TOTP is Time-based One Time Password. Most people use applications on their phone for TOTP, such as andOTP, Google Authenticator, and related apps. But, as we move from using a phone as a second factor for what we are doing on a computer to a phone being the primary way we interact with the Internet, it makes sense to make the computer the second factor. This is the idea behind this script. It is based on analyth’s script, except I stripped out the I/O.

#!/bin/bash

# Assign variables
google=$(oathtool --base32 --totp "YOUR SECRET KEY" -d 6)
wordpress=$(oathtool --base32 --totp "YOUR SECRET KEY" -d 6)
amazon=$(oathtool --base32 --totp "YOUR SECRET KEY" -d 6)

# Print variables
echo "google: ${google} | wordpress: ${wordpress} | amazon: ${amazon}"

This will print:

google: 123456 | wordpress: 123456 | amazon: 123456

However, I didn’t like the idea of my one time password codes only being protected by normal file protections on a Linux system. I thought it should be encrypted with gpg. So, I saved it to a file in my scripts directory, totp, and encrypted it with my public key. If you don’t have a gpg key pair, instructions are available online.

$ gpg -r your@email.com -e ~/pathto/totp

Then, to run the shell script, do:

$ gpg -d ~/pathto/totp.gpg 2>/dev/null | bash

This will prompt you for your gpg password and then run this script. You likely won’t want to remember this string of commands, so you could make your life easier by adding it as an alias under .bash_aliases

alias totp='gpg -d ~/pathto/totp.gpg 2>/dev/null | bash'

bash: Number of Days Between Today and Some Future Date

#!/bin/bash                                                        
                                                                   
printf -v date '%(%Y-%m-%d)T\n' -1                                 
echo $(( ($(date -d $1 +%s) - $(date -d $date +%s)) / 86400 )) days

Above is a bash script to output the number of days between today and some future date. Copy it into a file, e.g., diffdate.sh, into a directory, e.g., ~/bin/scripts. Then, enter the directory you saved it to and type to make it executable:

$ chmod +x diffdate.sh

Then, check your .profile to make sure something like this in it:

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then                             
  PATH="$HOME/bin:$PATH"
fi                                                                   

Then, run the script.

$ diffdate.sh 2021-06-01
70 days

I have to figure out the difference between today and some future date all the time for forecasting, and today was the day I finally bothered to figure out how to do it from the command line. I have to start thinking of ways to make shell scripts to do this little tasks that I go to the web for.

Fun With Fortune in Linux

Fortune provides a random quote or aphorism every time you open a terminal in Linux. I wanted to have a personalized fortune using zuihitsu quotes posted on this site come up whenever I opened a terminal. If you want to do something similar, here’s the procedure.

To check if you have it installed, simply type fortune into the terminal.

$ fortune 

This either returned a fortune or an error message. If you got an error message, then install fortune using the package manager for your system.

$ sudo apt install fortune-mod

Let’s create our own file of fortunes. I want to use my zuihitsu quotes I have posted on this site. This file is a text file that looks like so:

%
quote 1
%
quote 2
%
quote ...

There is a copy of the file available online.

If you have just a file with lines of quotes, this is easy to get into this format using emacs. Simply type: M-%, followed by c-q c-j Enter then c-q c-j % c-q c-j Enter. I like to check the replacements, so just keep hitting y to do the replacement and move on to the next one if it looks good. Save the file to the appropriate directory, which on Debian systems is /usr/share/games/fortunes, but can vary. For explanation purposes, we are going to assume the file was named zuihitsu with no file extension.

Note: If you are using the file above, just save it as a text file in your directory. Then, copy it to the appropriate system directory without a file extension.

Now, create a .dat file for the file you just made.

$ sudo strfile zuihitsu

Set the same permissions on the new files as the others in the directory. This just makes the files readable to groups and others.

$ sudo chmod o+r zuihitsu
$ sudo chmod g+r zuihitsu
$ sudo chmod o+r zuihitsu.dat
$ sudo chmod g+r zuihitsu.dat

Following the rest of the directory. I added a symbolic link.

$ sudo ln -s zuihitsu zuihitsu.u8

You should be able to test it now.

$ fortune zuihitsu

Assuming that worked. The final thing to do is to have your preferred shell call this when it runs. I use bash, so I added the command above to my bash_aliases file. From then on, it will pull a random quote from the zuihitsu file every time you bring up the terminal.

Bonus

Make a fortune come up automatically every time you login or open a new terminal by adding the following to .bashrc or .bash_aliases:

fortune zuihitsu 

Also, if you use mutt, you can add the following to your .muttrc file to have this fortune file generate a random signature for your emails:

set signature="fortune zuihitsu -s|"

The -s selects shorts quotes and the | pipes it to your email text.

Did you know the original fortune-mod fortune collection is available as a EPUB?

GOG Games on Linux, Featuring Blade Runner

Blade Runner is a point-and-click adventure, a genre that was still very popular on PCs at the time of its release. Games like Beneath a Steel Sky had already used the format to tell Blade Runner-inspired cyberpunk stories. Given the usual state of movie adaptations, a Blade Runner adventure game wouldn’t necessarily have been anything to get excited about.‘Blade Runner’ really does make you feel like a detective

What Westwood did with the license, however, was inspired. The game isn’t a straight retelling of the movie. (Harrison Ford’s Deckard is nowhere to be seen.) You play a detective named Ray McCoy on the tail of replicants linked to vicious animal murders. While the story takes place at the same time as the movie and involves some of the same locations and characters, it plays out in parallel without intersecting too strongly. This was a great decision for a narrative adventure, allowing the game to evoke the movie without feeling predictable.

-Sam Byford, “The resurrected Blade Runner game is a genuine classic.” The Verge. December 18, 2019.

Blade Runner is currently on sale for $8.99 until January 2nd, 2020, at 2 PM UTC. And, if you are into free (as in beer!) games, and who isn’t, you could also download the previously mentioned Beneath a Steel Sky for nothing.

But, there’s a catch. GOG doesn’t provide much help getting these games installed on a Linux system. I didn’t see any instructions, but let me save you some time. I documented what I did to get it to work, and now, you have the very instructions that should be on the GOG website, but are somehow, inexplicably, not there. We’re going to use Blade Runner as our example, but while I was looking into how to get this thing running, it was apparent that these problems happen on the Linux platform with many of GOG’s games.

Installing & Getting the Games to Work

Before starting, let’s make life easy for ourselves and get an outdated audio library that is needed in order for the game to launch.

$ dpkg -i libsndio6.1_1.1.0-3_amd64.deb

You’re also going to need Simple DirectMedia Layer 2, which you can install the standard way, through the repository:

$ sudo apt-get install libsdl2-net-2.0-0

Now, with those preliminaries out of the way, let’s get to the task at hand, shall we? Download the Blade Runner file from the GOG website. Open a terminal:

$ cd Downloads
$ chmod +x blade_runner_1_0_varies.sh 
$ ./blade_runner_1_0_varies.sh 

After installation, it should be in your Show Applications, which is in the bottom right corner for people using the standard Gnome window manager, and then, select the game you’ve just installed, if it isn’t Blade Runner.

Or, maybe you’ve learned to love the terminal, you could launch the game from the command line by opening a terminal:

$ cd GOG\ Games/Blade\ Runner/
$ ./start.sh

The game should launch from this point. If not, contact GOG and …Good Luck!

Webster’s Revised Unabridged Dictionary (1913) on StarDict on Ubuntu/Debian

So, after reading “You’re probably using the wrong dictionary,” I thought I would give installing Webster’s Revised Unabridged Dictionary (1913) on a Debian-flavor of Linux a try and write it up the process and some observations of its use.

Installation on a Debian-flavor of Linux is straight-forward:

$ sudo apt-get install stardict
$ cd Downloads
$ wget https://s3.amazonaws.com/jsomers/dictionary.zip
$ unzip dictionary.zip
$ cd dictionary
$ tar -xvjf stardict-dictd-web1913-2.4.2.tar.bz2
$ cd stardict-dictd-web1913-2.4.2/
$ sudo mv *.* /usr/share/stardict/dic/
$ stardict

This launches the main application. There is also a mini-window that can be moved to where you like and then you can use it with other applications by highlighting text. Here’s a screenshot of this article:

When you highlight a word, it will automatically be searched for and displayed in the mini-window.

Entries include pronunciation, etymological origin, related words, definition and an example of usage, often from literature. I can imagine this being a very useful tool. It might be worth checking if my writing from this date changes in an appreciable way and whether it is an improvement or not.

Setting DNS Manually on Ubuntu Linux

Introduction: Domain name servers (DNS) provide the numerical addresses for sites on the Internet. When you type cafebedouin.org into your browser, your computer queries a DNS name server to get a numerical address. This numerical address is then used to contact the site.  Normally, configuring DNS is handled behind the scenes by Dynamic Host Configuration Protocol (DCHP) automatically.

For some situations, you’ll want to set a different DNS server than the one set by DCHP. Maybe your Internet Service Provider (ISP) uses their own DNS server that is slower than Google’s DNS server. Maybe you use a Virtual Private Network (VPN) and want to stop DNS leaks to your ISP.

In Linux and other UNIX-like operating systems in the past,  you would change configuration files, such as /etc/resolv.conf or /etc/dchp/dhclient.conf, to set DNS manually. 

The problem: Changing resolv.conf and dhclient.conf configuration files does not work in Ubuntu.

The solution: Starting with 17.10, Ubuntu uses netplan to set DNS. On my test machine, netplan’s configuration file looks like this:

version: 2
   renderer: NetworkManager

It is possible to manually do the job of DCHP in netplan, but it’s complicated. If your objective is to just change the DNS servers, there is an easier way to do it. Use Network Manager.

There are files in the directory /etc/NetworkManager/system-connections that define how DCHP should work for each network connection. To the files listed in that directory, add the following with DNS server IP addresses under [ipv4]:

dns-search=
method=auto
dns=84.200.69.80;84.200.70.40;45.33.97.5;
ignore-auto-dns=true

The DNS servers in this example are from FreeDNS and DNS Watch.

After adding the DNS IP addresses, separated by a semi-colon, then from the command line, do: sudo service network-manager restart

Once completed, you should be on your DNS server of choice. It’s a little inconvenient to have to add these lines to each network-connection file, and there might be a better way. But, this will work.