Category: Snippets

  • Shared clipboard for Arch Linux as VMWare guest

    … aaaand I wanted to have a shared clipboard. It’s again all in the wiki, but again a bit distributed. So here we go.

    First: Install open-vm-tools and gtkmm, then add some modules to system bootup

    • “sudo pacman -S open-vm-tools gtkmm“
    • “sudo vim /etc/mkinitcpio.conf”
    • Under “MODULES=…” add the following: “vmxnet3 vmw_vmci vmw_pvscsi vmwballoon” (You probably don’t need most of them, but this is the config which worked for me. I didn’t try to remove them one-by-one to see which ones are _actually needed)
    • “sudo mkinitcpio -p linux”
    • reboot

    Second, make sure “vmware-user-suid-wrapper” is stared on login:

    • echo vmware-user-suid-wrapper > ~/.xinitrc
    • Logout and log in (or reboot)

    Done.

  • Install infinality fonts bundle in arch

    Installing custom repos in Arch is kind of annoying. But here’s how it goes (especially if you’re behding a firewall which permits only ports 80, 443 and 22):

    First. Switch the keyserver to a HTTP based one. To do this:

    1. edit /etc/pacman.d/gnupg/gnupg.conf
    2. replace “keyserver hkp://…” with “keyserver hkp://keyserver.kjsl.com:80”

    Second. Get the key ID for the repo (in my case from the wiki):

    • KEY ID is “962DDE58”

    Third. Download key from keyserver and sign it locally:

    • pacman-key -r 962DDE58
    • pacman-key -lsign-key 962DDE58

    Fourth. Add the repository to the pacman.conf file:

    • “vim /etc/pacman.conf”
    • add the lines from here

    Fifth. Update the repos

    • pacman -Sy

    Sixth. Install the f*** bundle:

    • pacman -S infinality-bundle

    That’s it 🙂

  • Fedora, docker and self-signed SSL certs

    I am behind a company firewall with a man-in-the-middle SSL certificate for secure connections. Can’t have viruses over SSL, can we?

    But apps which actually verify SSL connections (which is all of the apps using standard SSL/TLS/whatnot libs) do not like this. And rightfully so. But then we’re left with the following problem:

    $ docker search test
    FATA[0000] Error response from daemon: GEt https://index.docker.io/v1/search?q=test: x509: certificate signed by unknown authority
    $
    

    Now, to solve this on Fedora we do the following (all as root):

    • get a file with the signing certificate as PEM or DER format
    • place this file under /etc/pki/ca-trust/source/anchors
    • run “update-ca-trust extract”
    • restart docker (“systemctl restart docker.service”)

    A “man update-ca-trust” is also helpful to understand what’s happening.

    Sources:

    • http://is.gd/rzKxsO
    • http://is.gd/t9to1R
  • zsh and dot-directory completions

    I blog so I don’t forget. At least that’s what I’m telling me right now 🙂 .

    So. To make zsh complete – for example – “cd ..” (it should append a “/” on TAB, right?) set the following in the .zshrc:

    setopt autocd
    zstyle ':completion:*' special-dirs true    # please complete "cd .._/_" ...
    

    Great. Of course from Stackoverflow.

  • Synology and Git, II

    Don’t use the synology git package.

    But then Git’s not installed.

    I found a compromise:

    • Install the package
    • disable it
    • switch back the shells in /etc/passwd from to /bin/sh

    Be happy.

  • Sublime Text: Keyboard Shortcut for setting Tab Width

    Schwer zu finden … Wer schnell über das Keyboard die Tab Width verändern will, der tue das so:

    {
      "keys": ["super+k", "super+2"],
      "command": "set_setting",
      "args": {
        "setting": "tab_size",
        "value": 2
      }
    }
    

    (gefunden hier: http://is.gd/Pz9zE0)

  • NAS Performance & Mac

    Ich bin stolzer Besitzer eines Synology NAS. Das hängt mit meinem Mac an einem Gigabit-Ethernet, und funktioniert ziemlich gut. Große Dateien bekomme ich mit Transferraten von +- 100 MB/sec rüber.

    Aber.

    Möchte ich von meinem Mac aus eine Netzwerkfreigabe im Finder browsen – dann dauert das listen von Verzeichnissen SEKUNDEN. Anzeigen von JPGs (kleinen!) in der Vorschau auch gerne mal 10-20 davon.

    Abhilfe schafften nach langem googlen folgende Erste-Hilfe-Maßnahmen im Terminal:

    defaults write com.apple.desktopservices DSDontWriteNetworkStores true<br />
    sudo sysctl -w net.inet.tcp.delayed_ack=0<br />
    

    … und seitdem flutscht’s 😀

  • The limits of puppetDB a.k.a. etcd with puppet

    Okay. Maybe this is the completely wrong way to do this, but I found no other. Comments appreciated.

    Situation:

    • A DNS server cluster, meaning pacemaker managing an IP failover if one of them fails.
    • The cluster IP (the one switching over) should be the IP used for DNS lookups.

    Idea:

    • Hosts should automatically find ‘their’ DNS server using something. The DNS server should register itself somewhere so it is automatically set up during the first puppet run.

    So far, so good. Unfortunately there are a few problems with it. My first approach was something like this:

    ## THIS WILL NOT WORK
    
    # on every DNS server (*)
    @@resolv_conf_entry { $my_cluster_ip :
        tag = $domain,
    }
    
    # on every other machine:
    Resolv_conf_entry <<| tag == $domain |>>
    

    Unfortunately this will lead to a “duplicate declaration” on the client side – because all of the clustered DNS servers will export this, and the cluster_ip is identical on the DNS server hosts.

    The solution I came up with is etcd. A project from the girls and guys of CoreOS, which is basically a REST powered key-value store as trimmed down as possible, a binary about 3 MB, cluster-able, super-super-super simple to set up, and stand alone. The whole setup is like this:

    • etcd is installed on every puppet master
    • I wrote an etcd module(**) providing the methods etcd_set_value($etcd_url,$key_name,$key_value) and etcd_get_value($etcd_url,$key_name)
    • The $etcd_url is entered into hiera

    Now, we can do the following:

    # on each DNS server:
    $etcd_url = hiera('etcd_url')
    etcd_set_value( $etcd_url , "/puppet/dns_server_for/${domain}" , $my_cluster_ip )
    
    # on each other server:
    $etcd_url = hiera('etcd_url')
    $dns_server = etcd_get_value( $etcd_url , "/puppet/dns_server_for/${domain}" )
    resolv_conf_entry { $dns_server : }
    

    Works beautifully.

    Now go read the etcd docs and try to think of some other applications. etcd is a great tool (CoreOS is not too bad either, we’re evaluating it right now and are pretty amazed), and go use it. It is really much simpler than puppet.

    (*) Note that resolv_conf_entry{} is just a placeholder and does not exist (unless you write it).

    (**) I cannot – unfortunately – publish the module (yet), because the customer I wrote it for has not yet allowed me to.

  • Synology Git Server

    Ich besitze ab neulich eine wundervolle Synology DS414. Schönes Teil.

    Und da ich aktuell ein wenig programmiere zu Hause wollte ich mir hier ein Git repository server einrichten. Das ist nicht ganz trivial, und wer sich github- oder gitlab-ähnlichen Komfort erhofft … ah, nö. Es ist commandline only, und davon viel. Aber zum Punkt – der schnellstmöglichen Einrichtung eines Git-Repo-Servers auf einer Diskstation.

    • Der SSH-Zugriff unter Systemsteuerung > Terminal muss aktiviert sein.
    • Es müssen Benutzer angelegt sein, und diese müssen ein Home-Verzeichnis haben (für die ssh-Schlüssel, ohne die es keinen Spaß macht). Das home-Verzeichnis aktiviert man in der Systemsteuerung > Benutzer, dann oben ein Knopf Benutzerbasis (der 2. von rechts bei mir)
    • Wenn die Benutzer vorhanden sind legt man eine Freigabe an, das macht die Sache einfacher. Ich nutze /volume1/gitrepos.
    • Den eigenen ssh-Schlüssel ins home-Verzeichnis kopieren. Das sollte unter /volume1/homes/<Benutzer> erreichbar sein, das Volume hat man vorhin in Schritt (1) ausgewählt. (natürlich muss .ssh/ 0600 und . sein, und .ssh/authorized_keys 0700 und ., aber das muss ich ja nicht extra erwähnen, oder?)
    • Jetzt den Git-Service aktivieren, dem gewünschten Benutzer den Zugriff erlauben.
    • Ein repository anlegen ist leider Handarbeit:
    • Anmelden als root, dann nach /volume1/gitrepos wechseln, ein Verzeichnis anlegen …
    • … git init --bare ausführen, … und
    • und jetzt entweder alles word-writable machen (bäh), oder dem entsprechenden Benutzer mittels chown zuweisen (yup).
    • Beispiel: /volume1/gitrepos/my_repo
    • Schließlich auf dem Arbeitsrechner noch git das neue Repo übergeben: git remote add origin <user>@<diskstation>:/volume1/gitrepos/my_repo
    • … und das wars.

    Ganz einfach, oder? Naja.

    Quellen: Synology Wiki, Synology Forum

  • Oracle virtualization

    Ich hatte das zweifelhafte Vergnügen, mich mit OracleVM beschäftigen zu dürfen. Der Xen-basierten Virtualisierungslösung von Oracle. Zu dieser gehört der sog. “Oracle Manager”, eine WebLogic-basierte Anwendung zur Verwaltung aller VM hosts, cluster, VMs, und sonst noch allem. Die Aufgabe, die wir zu erledigen hatten, war prinzipiell einfach: Benutze den vorhandenen Manager, um auf 3 neuen Blades jeweils OracleVM (das Host-System) zu installieren, um dort ein paar virtuelle Maschinen laufen zu lassen. Der Trick: Die Blades waren über Trunk-Ports ans Netzwerk angeschlossen, da die VMs in verschiedenen Netzen operieren sollten.

    Und nach einer Woche testen fanden wir heraus, warum die Netz-Zuweisung mehr oder weniger zufällig funktionierte.

    Denn der grandiose Manager ignoriert vollkommen eine Änderung der angeschlossenen Netze auf der “Netzwerkkarte” der VM. Um das angeschlossene Netz zu ändern muss man …

    • die VM herunterfahren
    • die Netzwerkkarte löschen
    • eine neue Netzwerkkarte hinzufügen (gerne auch den gleichen virtuellen Adapter wie vorher), allerdings vorher schon das passende Netzwerk aussuchen
    • die VM starten

    Dann ist das Netzwerk geändert.