X-Git-Url: https://git.openstreetmap.org/chef.git/blobdiff_plain/4a9eb655d873ad80e9ada63056405c98c7a3e7b0..fa63c845987967418edaff22b75958916b19f19a:/cookbooks/tilecache/templates/default/nginx_generate_tilecache_qos_map.erb diff --git a/cookbooks/tilecache/templates/default/nginx_generate_tilecache_qos_map.erb b/cookbooks/tilecache/templates/default/nginx_generate_tilecache_qos_map.erb deleted file mode 100755 index efadcf602..000000000 --- a/cookbooks/tilecache/templates/default/nginx_generate_tilecache_qos_map.erb +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash -# DO NOT EDIT - This file is being maintained by Chef - -set -e -NUM_TOKENS=4 # current + 4 -VALID_TOKEN=3600 # in seconds -QOS_TOKENS=($(/usr/bin/oathtool --totp --window=${NUM_TOKENS} --time-step-size=${VALID_TOKEN}s -b <%= @totp_key %>)) - -# ${qos_tokens[3]/[-1] } = OSM.org exclusive / current -# ${qos_tokens[2]/[-2] } = tile.openstreetmap.org default -# ${qos_tokens[1]/[-3] } = stale ~ 1 hour -# ${qos_tokens[0]} = expired - -# Test if number of tokens returned by oathtool is expected number -if [ "${#QOS_TOKENS[@]}" -ne "$((${NUM_TOKENS}+1))" ]; then - >&2 echo "ERROR: Unexpected number of tokens" - exit 1 -fi - -QOS_TOKEN_OSM=${QOS_TOKENS[-1]} # Cookie set by openstreetmap.org -QOS_TOKEN_OSM_STALE=${QOS_TOKENS[-2]} # Cookie set by openstreetmap.org stale -QOS_TOKEN_DEFAULT=${QOS_TOKENS[-3]} # Cookie presented by tile.openstreetmap.org to browsers -QOS_TOKEN_STALE=${QOS_TOKENS[-4]} # Cookie which has become stale and will be replaced - -if [ -z "$QOS_TOKEN_OSM" -o -z "$QOS_TOKEN_DEFAULT" -o -z "$QOS_TOKEN_STALE" ]; then - >&2 echo "ERROR: Unexpected blank token" - exit 2 -fi - -cat </etc/nginx/conf.d/tile_qos_rates.map -default 4096; # Default Rate (No QoS cookie) -"${QOS_TOKEN_STALE}" 16384; # Stale -"${QOS_TOKEN_DEFAULT}" 24576; # Default -"${QOS_TOKEN_OSM_STALE}" 32768; # Exclusive Stale -"${QOS_TOKEN_OSM}" 32768; # Exclusive -EOF - -cat </etc/nginx/conf.d/tile_qos_cookies.map -default 'qos_token=${QOS_TOKEN_DEFAULT}; Secure; httponly; Max-Age=${VALID_TOKEN}; Domain=openstreetmap.org; Path=/'; # Cookie Domain per RFC6265 -"${QOS_TOKEN_DEFAULT}" ''; # Do not Set-Cookie. # Default -"${QOS_TOKEN_OSM}" ''; # Do not Set-Cookie. # Exclusive -EOF - -/etc/init.d/nginx configtest && service nginx reload