Using Google Talk Plugin in Palemoon Portable in Wine on Linux

Overview

My main browser is Palemoon Portable which I run in Wine on GNU/Linux. I also use Gmail, Google Talk (the pre-Hangouts tool), and Google Voice.

In order to make and receive phone calls from my main web gmail page, I used this process.

  1. Install Adobe Flash Player for Firefox on Windows. I used the offline installer from the download link at Weblink 2.
    1. Used my Linux native Firefox to navigate to the normal Adobe flash player download page.
    2. Selected “Need Flash Player for different computer?”
    3. Selected Windows 7/Vista/XP and FP 25 for Firefox – NPAPI.
    4. From a terminal, I ran the following command and installed Flash like normal.wine ~/Downloads/install_flash_player.exe
  2. Install Google Talk plugin.
    1. Unfortunately the gmail link for “Download voice chat plugin” failed to complete. When I ran wine ~/Downloads/GoogleVoiceAndVideoSetup.exe from a terminal, I observed that the process failed because of some network issue related to wine:fixme:secur32:schannel_get_cipher_algid unknown algorithm 23
      fixme:secur32:schannel_get_mac_algid unknown algorithm 200

      I bet it has something to do with the way my GNU/Linux computers always have some long MAC address in my dhcp list instead of a normal 12-character value. I don’t know how to fix that, nor was I able to trick the installer to continue.
    2. So I had to install the Google Talk plugin manually.
      1. I used a Windows computer that already had a working environment of Google Talk for Palemoon Portable. I copied these files:C:\Users\bgstack15\AppData\Roaming\Mozilla\plugins\npgoogletalk.dll
        C:\Users\bgstack15\AppData\Roaming\Mozilla\plugins\npo1d.dll
        To location
        /usr/share/PMP257/Lib/Mozilla/Plugins
        Where /usr/share/PMP257 is my D:\PortableApps location.
      2. I also copied this entire directory:C:\Users\bgstack15\AppData\Local\Google\Google Talk Plugin\
        As the directory
        /usr/share/PMP257/Lib/Mozilla/Plugins/Google Talk Plugin/
      3. I set up the wine registry with a key and values from a registry file as seen below.tf=/usr/share/PMP257/Lib/Mozilla/Plugins/googletalk.reg
        touch "${tf}"; chmod 0644 "${tf}"
        cat << EOF > "${tf}"
        REGEDIT4
        [HKEY_CURRENT_USER\Software\Google\Google Talk Plugin]
        "CrashReporterKeyPath"=dword:00000000
        "D3DXRedistKeyPath"=dword:00000000
        "DriverBlacklistKeyPath"=dword:00000000
        "install_dir"="z:\\usr\\share\\PMP257\\Lib\\Mozilla\\Plugins\\Google Talk Plugin\\"
        "neven_lm_installed"=dword:00000001
        "neven_sft_installed"=dword:00000001
        "nven_mft_installed"=dword:00000001
        EOF
        regedit "${tf}"

        If the registry file does not import properly, try sticking a blank line after REGEDIT4. WordPress and the html <code> tag do not play nicely together with blank lines in code.

Conclusion

This entire process was made possible by the fantastic users of the Portableapps.com community: portablealpha, taosk8r, acamp, and robertcollier4. It was that one page (weblink 1), and my working but disused Windows installation that made this whole process possible.

Backstory

I realize I make life hard for myself, for using a web interface in a portable version of a small fork of a web browser in an emulator.

The story behind why I use this portable browser, in wine, on Linux, is this. When I first started getting on the Internet, I was a teenager and did not own my own computer. I had a flash drive, and I used it to store my personal files. I discovered PortableApps which let me use probably Firefox 2 or 3 from my flash drive. Even as I grew and got my own computers, I still kept my main web browser as a portable one so it would be relatively free from OS hooks so it was easy to transplant from system to system, as I migrated my main workstation. I built up a new installation every couple of years, hopping from Firefox 17 at one point to 27 to 33 to 38. After that, I switched to Palemoon 25 Portable and that is what I’m still on as of this post.

Now, 2016 was the Year of Linux on the Desktop for me, as I wanted to avoid the Windows 10 debacle. I had installed Korora 22 Cinnamon on a spare laptop in November of 2015 and from there made it my main system. In February of 2016 I copied over my Palemoon Portable install and it ran in Wine just fine! The only problem it had was it didn’t work with Google Voice.

This week I was trying to solve a VLC dlna problem where it was not finding my Plex server. I got frustrated with that (a bug that’s still unresolved https://bugs.launchpad.net/ubuntu/+source/libupnp/+bug/1571199) and transitioned into looking into the Google talk problem on Palemoon Portable.

References

Weblinks

  1. Entire portableapps thread explaining how to get a PortableApp to use Google Talk. http://portableapps.com/node/24945

Portablealpha on September 15, 2010 – 9:18pm

Adding Google Voice plugin

Just wanted to let people know how I got the Google Voice plugin to work so that I could use the “Call Phone” feature from within gmail. This is *not* elegant but it’s the only way I could figure it out because the target computer is behind some nasty firewalls (and the Google Voice installer isn’t allowed to call home to download its files).

1. Install the Google Voice plugin on your home computer.
2. Locate the Google Voice and Video Accelerator plugins in FF using about:plugins.
3. Copy those to your Firefox Portable plugins directory on the flash drive.
4. Locate the “Google Talk Plugin” folder on your hard drive and copy it to the flash drive (doesn’t matter where).

When you want to use Google Voice through Firefox Portable, run the exe in the Google Talk Plugin first, then start FFP and go to gmail. Note that once you exit gmail, it will stop the exe, so you’ll have to run it again manually if needed.

Anyone have any suggestions to automate this?

Taosk8r on June 11, 2011 – 1:42am

Oh good

I found this thread again.. I cant seem to find where ff 4.0 puts these.. the info I get is:

npgoogletalk.dll
application/googletalk

npgtpo3dautoplugin.dll
application/vnd.gtpo3d.auto

Is this even still relevant?

Acamp on October 21, 2011 – 3:13am

Fantastic!

Works like a charm!

You have to search your computer for those two files (real pain in the ass on newer windows machines because they try not to display any scary system files). Once windows can’t find it, click advanced, check include non-indexed, hidden and system files.

You also need to search for the folder “Google Talk Plugin” and copy that to the flash drive. It contains the executable that needs to be launched before Firefox is opened

Robertcollier4 on September 28, 2012 – 7:33am

Works without needing to load the EXE manually

Create the following directory structure if not already existing:
FirefoxPortable\Data\Plugins\
ChromePortable\App\Chrome-bin\Plugins
Palemoon-Portable\Lib\Mozilla\Plugins

Place the following files/folders in Plugins directory:
npgoogletalk.dll
npgtpo3dautoplugin.dll
“Google Talk Plugin” (complete folder)
“Google Talk Plugin Extras” (complete folder)

The files are located at:
DocsandSettings\Username\Local Settings\Application Data\Google\Google Talk Plugin\
DocsandSettings\Username\Application Data\Mozilla\plugins\

Then it will work and the EXE will automatically load from Gmail.

Robertcollier4 on September 30, 2012 – 2:02pm

Specify path in registry to load EXE automatically

Hi – there is one update. If you want the EXE to run automatically, you must add the following registry key with the proper path to googletalkplugin.exe so that it knows where to find it and load it automatically. It will work without adding the registry path – but if the registry path is not there as shown below then you must run the googletalkplugin.exe manually before loading the browser.

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Google\Google Talk Plugin]
“install_dir”=”D:\\FirefoxPortable\\Data\\Plugins\\Google Talk Plugin\\”
“neven_sft_installed”=dword:00000001
“neven_mft_installed”=dword:00000001
“neven_lm_installed”=dword:00000001
“D3DXRedistKeyPath”=dword:00000000
“CrashReporterKeyPath”=dword:00000000
“DriverBlacklistKeyPath”=dword:00000000

  1. https://get.adobe.com/flashplayer/download/?installer=FP_25_for_Firefox_-_NPAPI&stype=5513&standalone=1
  2. Normal adobe flash player download page https://get.adobe.com/flashplayer/
Advertisements

Installing Korora 25 xfce in qemu/kvm

Overview

I wanted to install a Linux virtual machine on my Linux laptop. Already installed was virtual machine manager. For the time being, my host OS is Fedora 25 KDE and what I wanted to run in the vm is Korora 25 xfce. All this because I don’t know how to have two different versions of Teamviewer run at the same time.

Process

I downloaded the K25 xfce iso and then started the “Create a new virtual machine” wizard. The process was simple enough (minus scraping out enough disk space on my host). I ran into an issue with interacting with the virtual machine, though. During the install, I had to switch my display to VNC server type.

And even then, my mouse location was not aligned the cursor during the entire process. It’s a good thing Anaconda works with keyboard input! I was actually quite impressed because I’ve had trouble with keyboard input in anaconda for CentOS 7. But for Korora 25 it was fine.

Once I installed and rebooted, I switched the display back to “Spice server” and then everything worked smoothly: keyboard and mouse. Maybe I missed some guest additions package or something, because my screen doesn’t resize automatically with the window of the display. But selecting a different screen resolution in the xfce display utility worked just fine!

Linux use tee with color

Output in color on the console

The console normally can display color. The most obvious example is when you do a standard ls command. By default on most systems, ls includes a –color=auto flag that changes filenames of certain types to different colors.

Some applications display colorized output like systemctl status nfsd.service.

Using tee

Tee is a nifty cli utility that duplicates the input to both the standard out as well as to a file. You can use it like so:

ls -l --color=always | tee ~/ls.out

Some tools will disable colorized output if it is going to a pipe, but ls can be forced to provide color with the –color=always flag. For applications that don’t have such an option, you can usually prepend the command unbuffer.

unbuffer ansible-playbook playbook.yml | tee ansible.log

When you examine the file, however, you will observe that the console color commands were saved. That’s perfectly fine if you cat the file, or less -R, but normally you want a text file to just have the text. Sysadmins are quite used to dealing with logs that are all the standard color of the console.

The solution: ctee!

Using some fantastic resources on the Internet which I list at the bottom of this post, I assembled a tool that will tee the input, and send color to the stdout (usually the console) and send regular text to the file. I call my creation ctee.

Code walkthrough

So this script was generated using newscript which copies the template from the same bgscripts package. The template sources framework, which is my big flagship library of functions for shell scripts.

Lines 39-54 are the parseFlag function, which parses the command line passed parameters. I implemented this before I ever learned about Python’s argparse library.
The only flag worthy to note is –append. All it does is set the variable to 1.

The meat of this script starts at line 85 and goes to the end, which is shown below.

# this whole operation calculates where the stdout of this whole pipe goes
ttyresolved=0
_count=0
_pid=$$
_fd1="$( readlink -f /proc/${_pid}/fd/1 )"
while test ${ttyresolved} -lt 10;
do
   ttyresolved=$(( ttyresolved + 1 ))
   echo "before ${ttyresolved}, _pid=${_pid}, _fd1=${_fd1}" > ${devtty}
   case "${_fd1}" in
      *pipe:* )
         newpid=$( find /proc -type l -name '0' 2>/dev/null | xargs ls -l 2>/dev/null | grep -F "$( basename ${_fd1} )" | grep -viE "\/${_pid}\/"; )
         newpid=$( echo "${newpid}" | head -n1 | grep -oiE "\/proc\/[0-9]*\/" | grep -o "[0-9]*" )
         _pid=${newpid}
         _fd1="$( readlink -f /proc/${_pid}/fd/1 )"
         ;;
       *dev*|*/* )
         thisttyout="${_fd1}"
         ttyresolved=10
         ;;
   esac
done

echo "thisttyout ${thisttyout}" > ${devtty}

# MAIN LOOP
case "${append}" in
   1)
      tee ${thisttyout} | sed -u -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g" >> "${outfile1}"
      ;;
   *) tee ${thisttyout} | sed -u -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g" > "${outfile1}"
      ;;
esac

The idea behind ctee is that it uses tee, but inverts the outputs. Ctee uses the console tty as the file to output to, and then standard out continues on to a sed command that strips out the console color escape sequences which is then redirected to the file specified to ctee as a parameter.

So one of the big tricks is to derive which console you are executing this command from. The while loop from lines 90-106 use a /proc filesystem trick to find the process on the other end of a pipe. This loop travels from this process’s standard out to the standard in of another process, and then takes that standard out, and tracks that down until it includes the phrase “dev” or “/” in its name, indicating either a tty or a file (technically the dev is redundant, but it makes the line easier to understand).

The second main trick of ctee is that it has a sed command strip out the console color control characters. I found a nice way to remove that, and you can see those commands on lines 113 and 115. One line is for appending to a file, and the other is for overwriting.

Summary

You can use ctee.sh like so:

unbuffer ansible-playbook playbook.yml | ctee.sh /var/log/ansible/playbook.$( date "+%Y-%m-%d-%H%M%S" ).log

Which will get your console the colorized output that helps for easy interpretation of the output, with the normal logging for later analysis.

Ansible use ssh tunnel for http proxy

Overview

If you need to use a web proxy on an ansible node to get to the Internet, you can use the ansible role I hacked together. I had a need for using an ad-hoc ssh tunnel to a proxy server.

So your node will need an ssh key for automatic authentication to the proxy server over ssh. The role just executes a “ssh -N -p 22 username@proxy.example.com -L 1234/localhost/1234” and sets up the environment hash which includes http_proxy and https_proxy.

Check out the role at my github page.

Code walkthrough

My roles always have incredibly basic main.ymls because I always use a subdirectory architecture.
---
- hosts: all
tasks:
- include: tasks/main.yml
handlers:
- handlers/main.yml
vars_files:
- vars/main.yml

Now the tasks/main.yml file is where half of the work occurs.
---
# File: /etc/ansible/roles/use-proxy/tasks/main.yml
- name: clear any ssh tunnel
shell: ps -ef | grep -iE -- "ss[h].*{{local_proxy_port}}" | awk '{print $2}' | xargs kill -9
ignore_errors: yes
- name: start ssh tunnel
shell: nohup ssh -N -p {{proxy_server_ssh_port}} {{proxy_server}} -L {{local_proxy_port}}/localhost/{{proxy_port}} &
notify: stop ssh tunnel

It’s pretty clear what each task is doing. The start ssh tunnel opens up an ssh connection. If it is successful, it notifies the stop ssh tunnel handler which will execute at the end of the play.

- name: stop ssh tunnel
shell: ps -ef | grep -iE -- "ss[h].*{{local_proxy_port}}" | awk '{print $2}' | xargs kill -9

The handler searches for and kills the ssh connection that is using the specified port.

The vars/main.yml file is important because you must customize it to your environment.
---
proxy_port: 3128
local_proxy_port: "{{proxy_port}}"
proxy_server: tunnel@demo.example.com
proxy_server_ssh_port: 22
proxy_env:
http_proxy: "http://localhost:{{local_proxy_port}}"
https_proxy: "http://localhost:{{local_proxy_port}}"

How you use this role in a playbook is at the beginning of the list of roles. You also need to define the environment as seen below.
---
- name: Playbook that uses an ssh tunnel for http_proxy
hosts: test
remote_user: root
environment: "{{ proxy_env | default(omit) }}"
roles:
- { role: use-proxy, when: usehttpproxy is defined and usehttpproxy|bool == true }
- example

You can run this playbook with the use-proxy role and environment as is against any hosts that need the http proxy. To minimize traffic back and forth, just comment out the use-proxy role, and run the play against the regular hosts.

References

Weblinks

  1. https://ansiblemaster.wordpress.com/2016/04/29/run-ansible-tasks-to-a-remote-server-using-a-ssh-tunnel/
  2. https://www.engadget.com/2006/03/21/how-to-ssh-tunnels-for-secure-network-access/

Ssh use password this time

Problem

If you normally use passwordless authentication for your ssh sessions, you know how helpful it is. It saves you from having to type your password in all the time. You might have ssh keys set up (ssh-keygen) or kerberos.

In either case, you found this post because you want to use ssh with a password this time. You need to force ssh to use the password, just this once, without having to make all sorts of complicated requirements.

Solution

In either case, you found this post because you want to use ssh with a password this time. You need to force the password. Here’s how to do that:

function sshp { ssh -o PreferredAuthentications=password,keyboard-interactive -o PubkeyAuthentication=no -o GSSAPIAuthentication=no "$@"; }

The above snippet comes from my latest and greatest bgscripts.bashrc in my bgscripts package.

What the function does is execute ssh with a few extra options, that are very straightforward. It specifically lists the preferred methods for authentication, while disabling public key (which is what most people use) and kerberos auth (GSSAPI).

References

Weblinks

Cifs keepalive

Updated

This post originally talked about cifs-keepalive.sh, which is now bundled into the newer and more fully-featured shares.sh.

Overview

When a Linux system has a cifs mount to another server, sometimes it can time out. If you haven’t used it in a while, the connection becomes stale. If you do an ls -l /mnt it might take a while, and then return a ‘/mnt/cifsdirectory not found’ before displaying the directory contents.

Solution

My solution is a multi-tool script for network shares, which I simply call “shares.” It’s a part of my bgscripts package accessible on github.

Code walkthrough

Obviously, there are many ways to implement this. All my script does is touch a file in a cifs mounted directory every couple of minutes.

Check out its usage block from lines 18-33.

usage: shares.sh [-duV] [-r|-k] [-a] [-t <type>] [/mounted/directory [ ... ]]
version ${sharesversion}
-d debug Show debugging info, including parsed variables.
-u usage Show this usage block.
-V version Show script version number.
-r remount Remount shares
-k keepalive Touch shares to keep them from timing out
-a all All shares. Can be limited with -t. Default behavior if no directories provided.
-t <type> Only this type of share. Needs -a flag.
Return values:
0 Normal
1 Help or version info displayed
2 Invalid input options
3 Incorrect OS type
4 Unable to find dependency
5 Not run as root or sudo

The best way to run it is just with the -a flag. It will scan the currently mounted filesystems and list just the cifs/nfs ones as defined $validtypes. See lines 224-237,245:

# all currently mounted filesystems of the requested type
# get type, if requested
alltypes="$( echo "${validtypes}" | tr ' ' '|' )"
case "${type}" in
   "")
      searchstring="(${alltypes})"
      ;;
   *)
      if echo "${validtypes}" | grep -qiE "${type}" 1>/dev/null 2>&1;
      then
         searchstring="${type}"
      else
         searchstring="."
      fi

mount | grep -viE "${excludes}" | awk "/type ${searchstring}/{print \$3;}" >> "${tempfile1}"

And the actual keepalive command is just a touch –no-create, from lines 268-276.

keepalive)
   while read word;
   do
       debuglev 1 && echo "touching ${word}";
       touch --no-create "${word}/.fskeepalive" 1>/dev/null 2>&1
   done < "${tempfile1}"
   ;;

To make it run every three minutes, place a cron entry. Mine is in /etc/cron.d/shares-keepalive.cron:

*/3	*	*	*	*	root	/usr/share/bgscripts/shares.sh --all --keepalive 1>/dev/null 2>&1