Thursday 28 April 2016

How to stop google maps moving

It's annoying when you have a google map on a website and you try and scroll by it, but end up dragging it on mobile.

Well a solution!

In the gmap.js there is a function call called setOptions, in the parameter passed set 'draggable' : false, and that does the trick.

Saturday 23 April 2016

Preventing a Denial of Service attack on Wordpress

Preventing a DoS or Denial of Service attack on Wordpress is hard. These are the steps I took to prevent / stop a huge amount of traffic to Wordpress site which was causing it to crash after just a couple of minutes.

1. "yum list updates" - check to see if the Linux server is up-to-date
2. "sudo yum update" - make sure the Linux server is up-to-date
3. "yum install fail2ban", the config file is located here; "vi /etc/fail2ban/jail.conf"
4.  Install fail2ban wordpress plugin
5. "sudo curl https://plugins.svn.wordpress.org/wp-fail2ban/trunk/wordpress-hard.conf > /etc/fail2ban/filter.d/wordpress.conf" you may have to create is locally and do another sudo to move it in.
6. Edit the "/etc/fail2ban/jail.d/wordpress.conf" file as follows;

[wordpress]
enabled = true
filter = wordpress
logpath = /var/log/auth.log
port = http,https

7. Restart the fail2ban service; "service fail2ban restart"
8. However if you've auth protected Wordpress this may not be enough so do the following;
9. in the jail.conf add the following;

[http-get-dos]
enabled = true
port = http,https
filter = http-get-dos
logpath = /var/log/httpd/access_log
maxretry = 300 
findtime = 300
#ban for 500 minutes
bantime = 60000
action = iptables[name=HTTP, port=http, protocol=tcp]



[http-post-dos]
enabled = true
port = http,https
filter = http-post-dos
logpath = /var/log/httpd/access_log
maxretry = 15
findtime = 300
#ban for 500 minutes
bantime = 60000

action = iptables[name=HTTP, port=http, protocol=tcp]

10. Create a ttp-get-dos.conf file

# Author: http://www.go2linux.org
#
[Definition]

# Option: failregex
# Note: This regex will match any GET entry in your logs, so basically all valid and not valid entries are a match.
# You should set up in the jail.conf file, the maxretry and findtime carefully in order to avoid false positives.

failregex = ^ -.*GET

# Option: ignoreregex
# Notes.: regex to ignore. If this regex matches, the line is ignored.
# Values: TEXT
#

ignoreregex =

11. Create a ttp-post-dos.conf file

# Author: http://www.go2linux.org
#
[Definition]

# Option: failregex
# Note: This regex will match any GET entry in your logs, so basically all valid and not valid entries are a match.
# You should set up in the jail.conf file, the maxretry and findtime carefully in order to avoid false positives.

failregex = ^ -.*POST

# Option: ignoreregex
# Notes.: regex to ignore. If this regex matches, the line is ignored.
# Values: TEXT
#

ignoreregex =


12. Restart the fail2ban service; "service fail2ban restart"

That should start blocking those nasty DoS attacks quite well.

References
http://www.cyberciti.biz/faq/rhel-centos-fedora-linux-yum-command-howto/
https://www.maketecheasier.com/fail2ban-protect-apache-ddos/ - protect against DDoS

Sunday 2 August 2015

ApplePay and saving money at Lidl versus Tescos

Just shopped at Lidl for the first time. Firstly, was really impressed with range and quality of produce and fresh produce that they had. What blowed me away was how much cheaper it was than Tesco!

Just take a look;



I saved £5, on a £20 shop in Tesco it only cost me £15 at Lidl, very impressive that is a 25% saving. If I did that each week for a year that would be about £300 a year saved! Or on a £100 shop, I'd be saving £25.

Wow.

And they accepted ApplePay.

And it worked perfectly!

Friday 31 July 2015

ApplePay anecdotes

So I almost ran into the AppleWatch ApplePay, ran out of battery fail at mignight on Wednesday.

However before I went through the barriers to the overground train I discovered my last train had gone. Between there and the tube my AppleWatch ran out of juice! Lucky I had not swiped in!

Therefore I had a chance to use ApplePay on the iPhone 6 Plus. I didn't realise the NFC field would activate it, so I opened Passbook and fiddled for a while, as I couldn't work out how to make the card ready.

So I just placed it on the contactless reader on the gate and put my finger on the scanner. It took a while and was rather cumbersome, but it did work, and on the other end too.

Love the AppleWatch ApplePay tibe/overground/tfl experience, but I shall be avoiding doing it on my phone whete possible.

Monday 27 July 2015

Setting up new ApplePay card

After HSBC failed to launch ApplePay, I opened a Santander mastercard account. Today I got back from holiday and setup & activated my new credit card.

Pre-ApplePay, because it was a new card; I did a PIN transaction, then a contactless transaction, and only then did I add it to passbook.

Adding to iPhone Passbook was seamless, adding to AppleWatch, slightly more difficult. To add to AppleWatch you have to go via the AppleWatch app on the iPhone. On adding the Santander card, it did not appear on the AppleWatch, even after making it default.

An iPhone reboot did not resolve the issue.

Then I tried turning the AppleWatch off and on again. And just like that; it suddenly appeared on the AppleWatch. 

I then tried paying with the double click AppleWatch ApplePay - frictionless, wahoo!

Thursday 16 July 2015

Hidden feature for ApplePay in AppleWatch!

Quick post; just discovered you can double tap the side button on AppleWatch - the one that usually brings up friends/favourites/contacts, and you have your ApplePay card ready and active immediately.

OMG so convenient, this is the killer feature. No more navigating to Passbook, or using Siri to "Open ApplePay".

Monday 1 June 2015

Create your first Apple Watch App in Xcode

I had to upload to the latest Xcode for this to work.

Then you go to the main project settings window, click the + and add a new Apple Watch app, and mark all views (including glances).

Then add a label to the storyboard so you can see something output.

Then run the app, in simulator you can see the Apple Watch, by going to hardware > Apple Watch.

To run on your phone, you choose the WatchKit app schema to run, and choose your phone. The latest xcode will fix any signing and provisioning profile issues. If it does not, close Xcode and load it again, especially if it says that the Watch is not paired.

That's it, first Apple Watch App working.