Tuesday, 9 July 2019

Adding Time Tracking / Time Estimates to a Kanban project


Time tracking is, rather unhelpfully, not added as standard in Kanban Projects, which is not ideal when it comes to measuring velocity.

Here's how to get it...

Go to your project and select "Project Settings" from the sidebar. Then, click your way to your screen and configure it (e.g. (from Sidebar in Project Settings) Screens -> [pencil icon next to the screen scheme] -> click on desired screen -> Select "Time Tracking" )

Thursday, 11 October 2018

Vagrant file sync in Windows

Sometimes, vagrant boxes are provided without the VirtualBox Guest Additions preinstalled (I'm looking at you Centos).

If you need them for shared folders, just install the vagrant-vbguest plugin and add the following line to your Vagrantfile:

config.vm.synced_folder ".", "/vagrant", type: "virtualbox"
 

Tuesday, 14 August 2018

Installing latest version of git on Centos



The Centos repo for git is waaay out of date. Here's how to download an up to date version.

sudo yum -y install epel-release
sudo yum -y groupinstall development
sudo yum -y install curl-devel expat-devel gettext-devel openssl-devel perl-devel zlib-devel asciidoc xmlto docbook2X wget
sudo ln -s /usr/bin/db2x_docbook2texi /usr/bin/docbook2x-texi

obtain the URL of the version of git that you want to use from https://github.com/git/git/releases
wget <url of git release> -O git.tar.gz
tar -xvf git.tar.gz
cd git*
make all doc prefix=/usr && sudo make install install-doc installhtml install-man prefix=/usr

then run git --version to check if you are now on the one you want.

Thursday, 26 July 2018

Fixing a PC Keyboard on a Mac (Home and End keys)

Ensure your Mac has ben set up with a <countryname> PC keyboard profile in preferences.

Then edit (or create) the file ~/Library/KeyBindings/DefaultKeyBinding.dict

{
  "\UF729"  = moveToBeginningOfParagraph:; // home
  "\UF72B"  = moveToEndOfParagraph:; // end
  "$\UF729" = moveToBeginningOfParagraphAndModifySelection:; // shift-home
  "$\UF72B" = moveToEndOfParagraphAndModifySelection:; // shift-end
  "^\UF729" = moveToBeginningOfDocument:; // ctrl-home
  "^\UF72B" = moveToEndOfDocument:; // ctrl-end
  "^$\UF729" = moveToBeginningOfDocumentAndModifySelection:; // ctrl-shift-home
  "^$\UF72B" = moveToEndOfDocumentAndModifySelection:; // ctrl-shift-end
}

Reboot, and your home and end keys should be working perfectly!

Monday, 7 May 2018

Ubuntu 18.4 - Right click doesn't work on the touchpad

A very quick fix, for a very silly default behaviour...

By default, Ubuntu has been set up to respond to two finger taps  as a secondary / right click. Ah there's nothing like trying to alienate Windows users eh?

To fix this behaviour, you need to install the Gnome Tweaks tool.

You can do this in the terminal with:
$ sudo apt install gnome-tweak-tool

Or just hit the Windows key and type 'tweak' and select Gnome Tweak

Once installed, run the app, go to Keyboard and Mouse and chnage the Mouse Click Options to Area.


Boom! Right click is behaving like it should :)

Saturday, 13 January 2018

Automatically remove old kernels versions

Centos

sudo yum install yum-utils -y
sudo package-cleanup --oldkernels --count=2

Ubuntu

Free up space if you don't have any on your /boot partition

Find out which kernel you are running uname -r
Delete files that are not related to that kernel (e.g. rm *-79-*)
Now you have space you can run apt-get autoremove --purge
if you have any errors coming up add -f to force the command to complete 
finally, stop it happening again by editing /etc/apt/apt.conf.d/50unattended-upgrades and changing:
//Unattended-Upgrade::Remove-Unused-Dependencies "false";
to 
Unattended-Upgrade::Remove-Unused-Dependencies "true";

Thursday, 5 October 2017

Get graylog running on port 80 instead of 9000

If you are building a single service server (and if you are doing anything with log files the chances are that you are... then you might want to get Graylog working on a convenient port, like 80 rather than the default 9000.

By default ports below 1024 are privileged and normal applications are not allowed to run on them.

If you search the internet there are loads of conversations about how to do it the right way... well that is too complicated for me, so here's a quick and dirty way to get it set up.

Just run the service using the root user rather than the graylog user - yeah I know, all kinds of a bad idea if this is externally facing, but if it's internal then I think it'll be alright.

In Ubuntu:

sudo vim /etc/graylog/server/server.conf

Change the port number for rest_listen_uri and web_listen_uri to 80

sudo vim  /usr/lib/systemd/system/graylog-server.service

Change
User=graylog to User=root
Group=graylog to Group=root

Exit and run
systemctl deamon-reload
to apply the changes you just made




Sunday, 1 October 2017

Touchpad settings keep reverting - scroll in the wrong direction

I love my HP Envy, but I hate the way that the touchpad settings keep switching back after a few weeks.

This is due to the latest Synaptics touchpad drivers being loaded and it overwriting the settings. This is particularly noticeable as the scroll direction switched to "reverse"... honestly Synaptics why would you force reverse settings on anyone when it's obviously not the "right" way!

Anyway, enough about my pet peeves... how do you fix it.
Simple!

Open up regedit and go to:
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Synaptics\SynTP\Install

Change the setting DeleteUserSettingsOnUpgrade from 1 to 0#

Exit out of regedit, and that should be all you need to do. Your settings will not be overwritten when you get a new version of the touchpad driver.

Monday, 17 July 2017

Using redis failover with F5 and Kemp load balancers

I normally use an F5 for all my load balancing needs, but recently found myself needing to use a Kemp.

Setting up an F5 is easy, just create a pool, and set up monitor like so:


Basically this detects which node is the master and sets it as the only node active. Upon a failover, there will be a short outage and a new node will be elected and come online.

The principal is the same for the Kemp LB, but unfortunately you cannot send clear text.

You need to set:

Real Server Check Method: Binary Data
Checked Port: 6379 (or whatever port you are using)
Data to Send: 696e666f0d0a717569740d0a (this is the binary equivalent of the info command)
Reply Pattern: 726f6c653a6d6173746572
Find Match Within: 0



Your redis should now be working with your Kemp
Note that this does not work with Authenticated sessions.


Wednesday, 21 June 2017

Setting up Redis Sentinel as a service in Ubuntu


There are plenty of excellent documents on how to set up a Redis Master/Slave system, but very little on Sentinel.

Once you have Sentinel running reliably on the commend line, you will want to get Sentinel working as a service.

First, open up a new file:
vim /etc/systemd/system/sentinel.service

In there you probably want something like:

[Unit]
Description=Sentinel for Redis
After=network.target

[Service]
LimitNOFILE=64000
User=redis
Group=redis
ExecStart=/usr/local/bin/redis-sentinel /etc/redis/<your configuration file>.conf --daemonize no

[Install]
WantedBy=multi-user.target

You then need to make sure that the user you are using to run the service (in this case redis) has permissions for both the configuration file 

chown redis:redis /etc/redis/<your configuration file>.conf

and the log files you have set up in your configuration file

chown redis:redis /var/log/redis/<your log file>.log

Test everything works as expected by:

systemctl start sentinel

then 

systemctl status sentinel

You should get something that looks like:

If you do, then everything is good and you can set your service to start automatically with:

systemctl enable sentinel

Wednesday, 1 March 2017

Configuring Graylog for LDAP and Active Directory

Configuring LDAP and Active Directory authentication for graylog is pretty simple.

Server configuration


Go to http://<graylog_server>/system/authentication/config/legacy-ldap

Tick "Enable LDAP" duh!

Set the server type - in my case it's Active Directory

Server address ldap:// <IP address or FQDN of your domain controller> : 389

If you are using this externally, you really should be using ldaps to  ensure that your authentication between the graylog server and the DC is encrypted... in fact it's best practice to do this as standard

System username: This is the full URL for a user who has permissions to browse the AD. In my case I create a service account user just for this purpose. They don't have any other access and don;t forget to set the account and password to never expire.

CN=LDAP-Authentication-Only,OU=Service-Accounts,OU=Users,DC=uk,DC=company,DC=local

Don't know what the full URL is? Just install Softera LDAP Browser and look at the properties for your user and you can extract the URL.

System password: <The service account password>

Test Server connection.. go on... get a green message before proceeding!

User mapping


Search Base DN: You don't want to search the whole AD, so this allows you to specify the folder that you want to search below. Usually this is your Users OU - again use Softera to find the full URL

OU=Users,DC=uk,DC=company,DC=local

User search pattern: This is used to make sure you only have user objects and search for the samAccount name - basically it means you can log in with your short username e.g. jsmith rather than your full email address. Just use the setting they tell you: 

(&(objectClass=user)(sAMAccountName={0}))

Display Name Attribute: How you want your user to appear, I just used displayName, but you could use cn if you wanted "Firstname Lastname" 

At this stage, you can now go to step 5 and do a login test... hopefully it should all go well, and you can save your changes and anyone in the AD can log on!

If it fails, make sure you are not using a username that is already in the graylog user database... this caught me out and I had to delete the local user before it would work.

Group Mapping



The first time you log in with an AD accoint you will notice that you don't have a search option, this is because Graylog have decided that they want regular users to use streams. 

If you want AD users to be admins (and have search capabilities) you need to set up Group Mappings.

First thing to do is set up a couple of Security Groups in AD. I chose to call them "Graylog Users" and "Graylog Admins"

Group Search Base is very similar to the Search Base DN you just set up.. but in this case point it to the OU that has all your groups below it.

OU=Groups,DC=uk,DC=company,DC=local

Group Search Pattern should be set up to tell Graylog to search for groups with a particular string, in my case I used:

(&(objectClass=group)(cn=Graylog*))

Note that this is CaSe SeNsItIve

Group Name Attribute should be cn

Default User Role defines what permissions everyone is created with when they log on for the first time. I left mine at Reader - basic access as I don't want everyone able to break my system.

You should no save your changes. 

Now it's time to map your Active Directory groups to Graylog roles by going to http://<graylog_server>/system/ldap/groups

Just pick your AD groups and assign the permissions you want for members of that group.

Congratulations you have set it up..now log on with your AD/LDAP user and start playing :)

Monday, 27 February 2017

Disable Shutdown and Suspend start menu on Windows 10 Home


Shamelessly ripped from a Microsoft article:


We have to Disable and Remove Shutdown option using Registry Editor.  Open Registry Editor, go to following path: HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer
Select Explorer in the left-hand pane, right click in the right-hand pane and select New >DWORD; then name it as NoClose.
Double click on NoClose and change the Hex Value to 1; Click OK and Close Registry Editor.
Restart, you will be able to Disable and Remove Shutdown in Windows 7 Home Premium or lower in this way.

Sunday, 29 January 2017

Very slow disk access with VMware ESX and HP Gen8 Microserver

I recently swapped my home ESXi server from an ageing Dell desktop for a nice new HP MicroServer Gen8
I love the new server, with it's enterprise level features, and its ability to just use any old SATA drive.
As a special treat I got an SSD as one of the datastores, as well as an existing regular HDD (aka spinning rust).

However, when I started using VMs in anger I was disappointed by the speed they were performing at... in fact things felt slower than on the desktop!

I had installed ESXi on a USB stick and used the latest build direct from the HP website, so everything must be fine on that end... so I must be imagining it, right... right?

The first thing I did was move my VM over from the HDD to the SDD (which took ages for only 20Gb) and observed that it did not feel significantly quicker.

So I whipped out IOmeter and started to do some benchmarking.

I was seeing only 1.1 MB/s read/write on the HDD, having nothing to compare this to, I shrugged and ran a test on the SSD and expected to get a significant improvement... but no all I got was 1.5MB/s. Even worse, I ran IOmeter against my SAN (an HP Gen8 running unRAID and 4 HDDs) and was seeing 89 MB/s!


After some ninja googling, I came across this article

It appears that the driver for the built in HP disks is faulty in the current version and you need to load up an old version to get your performance back.

So, here's how to fix it:

Copy the v88 driver from here: http://vibsdepot.hp.com/hpq/nov2014/esxi-550-drv-vibs/hpvsa/
(Don't worry if you are running ESX6, this will still work despite saying ESX5.5 in the file name).


  • Stop all VMs
  • Enable ssh-conection if it is not already turned on
  • Copy "scsi-hpvsa-5.5.0-88OEM.550.0.0.1331820.x86_64.vib" to /tmp  (using WinSCP)
  • Start ssh-conection (using putty)
  • change directory to /tmp
    cd /tmp
  • Copy the vib file to /var/log/vmware
    cp scsi-hpvsa-5.5.0-88OEM.550.0.0.1331820.x86_64.vib /var/log/vmware/
  • Start maintenanceMode
    esxcli system maintenanceMode set --enable true
  • Deinstall the running  scsi-hpvsa driver
    esxcli software vib remove -n scsi-hpvsa -f
    This may take a few minutes to complete...
  • Install scsi-hpvsa-5.5.0-88
    esxcli software vib install -v file:scsi-hpvsa-5.5.0-88OEM.550.0.0.1331820.x86_64.vib --force --no-sig-check --maintenance-mode
  • Restart ESXi
  • Disable maintenance mode
  • Start VMs

And what was the result?

HDD now 6.15 MB/s (a 459% increase)


SSD now 55.85 MB/s (a 3623% increase!!!!)


Wow!

UPDATE for VMWare 6.5 Update 1

Upon rebooting with the new (old) driver, my VMware instance did not mount the existing HDDs automatically.

To get round this I ran

esxcfg-volume -l

Scanning for VMFS-3/VMFS-5 host activity (512 bytes/HB, 2048 HBs).
VMFS UUID/label: 57ea5aca-e9e426b3-fcce-6805ca2ee445/HDD1
Can mount: Yes
Can resignature: Yes
Extent name: t10.ATA_____ST1000DM0032D1ER162__________________________________Z4Y3LBLN:1        range: 0 - 953599 (MB)

Scanning for VMFS-3/VMFS-5 host activity (512 bytes/HB, 2048 HBs).
VMFS UUID/label: 57ea59d4-98d844d8-e3c8-6805ca2ee445/SSD1
Can mount: Yes
Can resignature: Yes
Extent name: t10.ATA_____Crucial_CT256MX100SSD1__________________________14510E1BBC87:1 range: 0 - 243967 (MB)

Then took did a

esxcfg-volume -m HDD1
esxcfg-volume -m SSD1

and that fixed the issue :)



Monday, 23 January 2017

iDRAC 6 communication failure on PE 710

I recently had an issue where my Dell PowerEdge 710 was displaying an "iDRAC 6 communication failure"error message and refusing to boot cleanly.
This was really aggravating as it would not clear, even if I removed the physical DRAC card.

Eventually I came across this article which advised changing the Power Recovery policy (under Securty) to "always off". One full power off later, and everything is working as expected!

Silly Dell...

Monday, 2 January 2017

MS OneNote / OneDrive stops syncing using Pi-Hole

A quick post to let you know about how to work around the PITA issue of using Pi-Hole, Windows 10, OneNote and OneDrive

I recently rebuilt my Pi-Hole server, moving from a Raspberry Pi to a Ubuntu VM.

As soon as I started using the new DNS server it became apparent that there were a few issues with Microsoft services. First Skype wouldn't sign in properly and I did a bit og googling around and found some addresses that need to be whitelisted. Hmm, strange, why would I need to whitelist something as mainstream as Skype... ho hum I thought, it must be a one off.
Several days later I fired up OneNote on my new tablet (Google Pixel C by the way - fantastic device) only to be prompted to sign in to retireve the notebook stored on OneDrive - which promptly barfed and gave a "something went wrong, try again later message).
Great... so I tried it on my laptop and got the same issue... hmm, what's changed? Well only the PiHole server.
I dodn;t know what URL OneNote was accessing, but upon googling around I noticed that I could not access support.microsoft.com and decided to use this to track down the issue.

Logging on to the Pi-Hole server I ran:

root@dns:~# pihole -q support.microsoft.com

::: /etc/pihole/list.0.raw.githubusercontent.com.domains (2 results)
#               see: http://support.microsoft.com/kb/2764944
0.0.0.0 diagnostics.support.microsoft.com

::: /etc/pihole/list.1.mirror1.malwaredomains.com.domains (0 results)

::: /etc/pihole/list.2.sysctl.org.domains (0 results)

::: /etc/pihole/list.3.zeustracker.abuse.ch.domains (0 results)

::: /etc/pihole/list.4.s3.amazonaws.com.domains (0 results)

::: /etc/pihole/list.5.s3.amazonaws.com.domains (0 results)

::: /etc/pihole/list.6.raw.githubusercontent.com.domains (2 results)
diagnostics.support.microsoft.com #Microsoft
support.microsoft.com #Microsoft

::: /etc/pihole/list.preEventHorizon (2 results)
diagnostics.support.microsoft.com
support.microsoft.com

grep: /etc/pihole/blacklist.txt: No such file or directory
::: /etc/pihole/blacklist.txt (0 results)


Hmm, so it looks like whatever generated list.6.raw.githubusercontent.com.domains  is the issue... let's take a look at that

sudo vim /etc/pihole/adlists.default

This seems to be the problem site

# The below list amalgamates several lists we used previously.
# See `https://github.com/StevenBlack/hosts` for details
https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts

Looks like they have chosen to be super paranoid and block legitimate non-ad-serving addresses because they include the list from https://github.com/crazy-max/WindowsSpyBlocker.

Now ideally I'd just use an option of the list that didn't exclude the microsoft domains, but that's not an option, so I just commented out the line like so
# https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts

Then reinitialised with 
/opt/pihole/gravity.sh

And everything started working!




Wednesday, 21 December 2016

Static addresses with Graylog

Graylog is a great tool for storing your syslog data.
Even better, they provide a virtual appliance to simplify downloading.
Probably the first thing you will want to do is give it a static IP address (as most network devices don't allow you to use a name as a syslog destination).

So first log on to the console and:
vim /etc/network/interfaces

change 

iface eth0 inet dhcp

to

iface eth0 inet static
    address 10.0.0.41
    netmask 255.255.255.0
    network 10.0.0.0
    broadcast 10.0.0.255
    gateway 10.0.0.1
    dns-nameservers 10.0.0.1 8.8.8.8
    dns-domain acme.com
    dns-search acme.com

Using your IP addresses obviously!

exit, and run:

ifdown eth0
ifup eth0

to restart networking with the new settings.

Now you need to tell graylog that things have changed, so just run 

sudo graylog-ctl reconfigure

This will go through all the settings and ensure it works with the new IP address

Tuesday, 29 November 2016

Resize LVM in Centos 7 using gparted

Boot into gparted ISO and resize your partition to the desired size.

Apply the changes and boot into regular Centos.

Use 

vgdisplay | grep "Free  PE" 

to view the free space and note the first value which is the number of free blocks


lvdisplay | egrep 'Path|Size'
  LV Path                /dev/centos/swap
  LV Size                1.60 GiB
  LV Path                /dev/centos/root

  LV Size                77.91 GiB

Note the partition name you want to expand

Now we need to extend the LV

lvextend -l+<number of blocks> <partition to be grown>

e.g.
lvextend -l+4222 /dev/centos/root


Finally, you need to extend the xfs file system to match the partition

fsadm resize <partition to be grown>

e.g.
fsadm resize /dev/centos/root


Thursday, 8 September 2016

Connecting ESXi 6 to a Unraid NFS share

While not having the flexibility of other NAS applications, I find Unraid to be an excellent product. I use it to store my media, and act as a file store for my bigger files.

My home ESXi box is running low on storage, so it was time to start looking at keeping some files on the Unraid NAS.

Now, the NAS is never going to be super fast, so rather than store live VMDKs on there, the idea is to use it as a store for my ISO files, of which I have built up quite a collection.

So first things first - lets enable NFS in Unraid through Settings - Network Services - NFS


Now go to Shares and select an existing share and you should see an NFS section. Set the Export value to Yes, and set Security to Public (as this is an internal deployment and it's only me using it).

Click Apply and you are all done at the NAS end.

Hop on over to the ESXi 6 management web console, right click on the Storage title in the left menu and select New datastore.

Select Mount NFS datastore, and on the following screen enter the connection details.

Name: Name that you wish the ESXi server to know the datastore as
NFS server: The IP address or FQDN of the Unraid NAS
NFS share: /mnt/user/<name of the share on the NAS> (you can ssh onto the NAS and do a ls -l /mnt/user to double check)
NFS version: NFS 3 (as we are not using username and password) otherwise NFS 4


Click next and you will be shown a confirmation, so click Finish and you should be all set up. You may need to refresh the Datastores tab on the ESXi web front end just to display it.

Easy!



Sunday, 31 July 2016

Automating with the Energenie MiHome controller: The API

It's all well and good doing cool things with MiHome and IFTTT, but what if you really want to get geeky... well it's time to try out the API.

While I must praise Energenie for having a documented API, I initially found the lack of real world examples confusing. Through trial and error, I eventually worked out that you need the following details to start using the API.

List the device groups:

curl -u "a<email address>:<password>" https://mihome4u.co.uk/api/v1/device_groups/list

Up will come a long stream, somewhere in there will be the device group ID number you want.. but rather than struggle to work out where it is, I suggest you log on to the website, find the group you want to action and hover over the Edit link. In the URL you will see the device group id number.



From there it's a simple case of using the credentials you use to log on to https://mihome4u.co.uk, and you can use CURL to action your request.

curl -u "<email address>:<password>" -X POST -H "Content-Type: application/json" -d "{\"id\":<device_group_id_number>}" https://mihome4u.co.uk/api/v1/device_groups/power_on

Simple!

Automating with the Energenie MiHome controller: The Android app, and IFTTT

First things first... opening the Mi|Home app plays a little jingle... how very Windows 95. Let's hope the developers take notice of the comments on the reviews and at least make it an option, or preferably get rid of it altogether.

The app itself is quite pretty and gets the job done. Here you can see all my devices and the device groups.


On my Samsung Galaxy S6 Plus with a 5.7" screen at 1440 x 2560 resolution the buttons are on the small side, but usable.

Never mind, I thought to myself, I'm sure they have a widget that would enable me to turn all the lights off with a click of a single button on the homescreen as I blearily stumble off to bed.

Hmm, so no widget eh? Well this just became a bit less useful.

I wonder if the IFTTT integrations can help?

First you'll need to connect to IFTTT through the phone app


Then install the IFTTT DO Button app 

Fire up Do and click on the grey pestle and mortar icon to create your recipe.


Click on the grey plus bar, choose Channels, scroll down and select "Enegenie Mi|Home"


Create a new recipe

Select the action i.e. power on or off a device or group. Give the recipe a pithy name, and click Add


Congratulations, you now have a big full screen button to do your bidding.

But it's still not quite as easy as I want, so the next step is to go to your home screen, press and hold in a blank space and choose to add a widget. Select DO button and you will be presented with a list of your recipes, choose the appropriate one, and you are all set!


Click the Do button widget and run around amazing you friends and family with the awesomeness!