config.php.j2 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  1. <?php const CONFIG = array(
  2. // The type of storage backend Hauk will use. Valid values include:
  3. // MEMCACHED, REDIS
  4. //
  5. // For MEMCACHED, you need either the `memcached` or `memcache` extensions
  6. // enabled in PHP.
  7. //
  8. // For REDIS, you need `redis` extension enabled. Note that `redis` depends on
  9. // `igbinary`, so if you get an error that a redis extension was not found, even
  10. // though you enabled `redis`, you may have to also install and enable
  11. // `igbinary` in PHP.
  12. "storage_backend" => REDIS,
  13. /*----------------------------------------------------------------------------*\
  14. | MEMCACHED SPECIFIC SETTINGS |
  15. \*----------------------------------------------------------------------------*/
  16. // Connection to memcached for data storage. To connect via UNIX socket instead
  17. // of TCP, set host to 'unix:///path/to/memcached.sock' and port to 0.
  18. "memcached_host" => 'localhost',
  19. "memcached_port" => 11211,
  20. // If you use SASL authentication, change both `memcached_binary` and
  21. // `memcached_use_sasl` to true, and enter your SASL username and password.
  22. // Note: SASL authentication is only supported in the PHP `memcached` extension!
  23. // If you are using `memcache` and need SASL, consider switching to `memcached`.
  24. "memcached_binary" => false,
  25. "memcached_use_sasl" => false,
  26. "memcached_sasl_user" => "",
  27. "memcached_sasl_pass" => "",
  28. // A prefix to use for all variables sent to memcached. Useful if you have a
  29. // shared memcached instance or run multiple instances of Hauk.
  30. "memcached_prefix" => 'hauk',
  31. /*----------------------------------------------------------------------------*\
  32. | REDIS SPECIFIC SETTINGS |
  33. \*----------------------------------------------------------------------------*/
  34. // Connection to Redis for data storage. To connect via UNIX socket instead of
  35. // TCP, set host to '/path/to/redis.sock'.
  36. "redis_host" => 'cache.service',
  37. "redis_port" => 6379,
  38. // If you use password authentication in Redis, set `redis_use_auth` to true and
  39. // enter the password in `redis_auth`.
  40. "redis_use_auth" => true,
  41. "redis_auth" => '{{redis_password}}',
  42. // A prefix to use for all variables sent to Redis. Useful if you have a shared
  43. // Redis instance or run multiple instances of Hauk.
  44. "redis_prefix" => 'hauk',
  45. /*----------------------------------------------------------------------------*\
  46. | AUTHENTICATION |
  47. \*----------------------------------------------------------------------------*/
  48. // Users must be authenticated to use the Hauk server. The default
  49. // authentication method is using a static server password that is shared by all
  50. // users, without the need for a username. You can, however, use other
  51. // authentication methods. Valid values here include:
  52. //
  53. // - PASSWORD: Use a static, shared server password for everyone
  54. // - HTPASSWD: Require a username and separate password for each user
  55. // - LDAP: Authenticate users against an LDAP server
  56. "auth_method" => PASSWORD,
  57. /*----------------------------------------------------------------------------*\
  58. | PASSWORD AUTHENTICATION |
  59. \*----------------------------------------------------------------------------*/
  60. // A hashed password that is required for creating sessions and posting location
  61. // data to Hauk. To generate this value on the terminal:
  62. // - MD5 (insecure!): openssl passwd -1
  63. // - bcrypt (secure): htpasswd -nBC 10 "" | tail -c +2
  64. "password_hash" => '{{hauk_password}}',
  65. // Default value above is empty string (no password) and is VERY INSECURE.
  66. // Trust me, you really should change this unless you intentionally want a
  67. // public instance that anyone in the world can use freely.
  68. //
  69. // Also note that users have the option to save the server password locally on
  70. // their devices using a "Remember password" checkbox. If they choose to do so,
  71. // the password will be stored in plain text (unhashed) on their devices. You
  72. // are encouraged to generate a random password to prevent risks associated with
  73. // credential reuse, should the password somehow be leaked from their devices.
  74. /*----------------------------------------------------------------------------*\
  75. | HTPASSWD AUTHENTICATION |
  76. \*----------------------------------------------------------------------------*/
  77. // A file that contains a pairing between users and hashed passwords. To
  78. // generate this file on the terminal:
  79. // - htpasswd -cBC 10 /etc/hauk/users.htpasswd <username>
  80. // To add additional users to an existing file:
  81. // - htpasswd -BC 10 /etc/hauk/users.htpasswd <username>
  82. "htpasswd_path" => '/etc/hauk/users.htpasswd',
  83. /*----------------------------------------------------------------------------*\
  84. | LDAP AUTHENTICATION |
  85. \*----------------------------------------------------------------------------*/
  86. // URI that points to the LDAP server. Use "ldap://" for unencrypted LDAP as
  87. // well as when using StartTLS, use "ldaps://" for regular LDAP over TLS. Port
  88. // number is typically 389 (ldap) or 636 (ldaps).
  89. "ldap_uri" => 'ldaps://ldap.example.com:636',
  90. // Whether or not you wish to use StartTLS. StartTLS cannot be used in
  91. // combination with `ldaps`.
  92. "ldap_start_tls" => false,
  93. // Base DN to search for users.
  94. "ldap_base_dn" => 'ou=People,dc=example,dc=com',
  95. // DN to bind to to perform user search. This should ideally be a read-only
  96. // account as the password is stored in plain-text in this config file.
  97. "ldap_bind_dn" => 'cn=admin,dc=example,dc=com',
  98. "ldap_bind_pass" => 'Adm1nP4ssw0rd',
  99. // A filter that finds the user trying to authenticate. %s is substituted with
  100. // the username provided by the user in the app.
  101. //
  102. // You can also use this to restrict access to Hauk to only authorized users if
  103. // you do not wish to grant all LDAP users permission to use your Hauk instance.
  104. // For example, (&(uid=%s)(memberOf=cn=HaukUsers,ou=Groups,dc=example,dc=com))
  105. // will only let the user connect if they are part of the "HaukUsers" group in
  106. // the "Groups" OU.
  107. "ldap_user_filter" => '(uid=%s)',
  108. /*----------------------------------------------------------------------------*\
  109. | GENERAL SETTINGS |
  110. \*----------------------------------------------------------------------------*/
  111. // Hauk v1.4 and on allows you to request a custom link ID instead of having the
  112. // server randomly generate one. Custom links can use characters A-Z, a-z, 0-9,
  113. // - (dash), and _ (underscore). If you want to disallow the option to request
  114. // custom links, set this to false.
  115. //
  116. // If a user requests particular custom link that is already in use, that user
  117. // will not have their request honored and will get a randomly generated link
  118. // instead.
  119. "allow_link_req" => true,
  120. // If you want certain links to only be usable by some users, you can reserve
  121. // them here. The following example reserves https://example.com/?WheresAlice
  122. // for user "alice" only, and reserves https://example.com/?TheRealBob
  123. // for use by both "bob" and "charlie".
  124. //
  125. // If you use Tasker or another automation platform to automatically start
  126. // sharing to a specific link ID, it's a good idea to specify it here so that
  127. // others cannot use it while you are inactive.
  128. //
  129. // Note that for this setting to have any effect, you have to specify an
  130. // auth_method that requires both a username and a password, such as HTPASSWD.
  131. "reserved_links" => [
  132. 'WheresAlice' => ['alice'],
  133. 'TheRealBob' => ['bob', 'charlie'],
  134. ],
  135. // If you want to enable pre-approved custom links only, you can choose to
  136. // enable reservation whitelist mode. If this setting is set to true, custom
  137. // link IDs will only be accepted if they are present in the reserved_links
  138. // array above - requests to share to other links than those in the array will
  139. // not be honored.
  140. "reserve_whitelist" => false,
  141. // The type of links to generate when making new links for shares. Can be any
  142. // of the following:
  143. //
  144. // | Link style | Example | No. of combinations | Avg. bruteforce time |
  145. // +----------------------------+---------------------------------------+-----------------------+-------------------------------+
  146. // | LINK_4_PLUS_4_UPPER_CASE | V8LQ-H2UM | 1.79 * 10^12 (34^8) | 28.3 years |
  147. // | LINK_4_PLUS_4_LOWER_CASE | qae3-ulna | 2.82 * 10^12 (36^8) | 44.7 years |
  148. // | LINK_4_PLUS_4_MIXED_CASE | HEq3-tgJ1 | 1.28 * 10^14 (58^8) | 2030 years |
  149. // | LINK_UUID_V4 | 09c8a3b1-e78f-48b1-a604-0da49e99cb5d | 5.32 * 10^36 (2^122) | 84.2 septillion years |
  150. // | LINK_16_HEX | 6cde14c4c6551b41 | 1.84 * 10^19 (2^64) | 292 million years |
  151. // | LINK_16_UPPER_CASE | WVHA2FNMRT9HSKJK | 3.19 * 10^24 (34^16) | 50.6 trillion years |
  152. // | LINK_16_LOWER_CASE | bdyslxszs14cj359 | 7.95 * 10^24 (36^16) | 126 trillion years |
  153. // | LINK_16_MIXED_CASE | 1Ayh2yUXDe3sdF3S | 1.64 * 10^28 (58^16) | 260 quadrillion years |
  154. // | LINK_32_HEX | 22adf21f11491ae8f3ae128e23a6782f | 3.40 * 10^38 (2^128) | 5.39 octillion years |
  155. // | LINK_32_UPPER_CASE | R88M1Z2KPL27XN8MF73KCRYPHJD4QQMT | 1.02 * 10^49 (34^32) | 161 undecillion years |
  156. // | LINK_32_LOWER_CASE | itgbolrbq1c02eot5o46c5wixhdrdb5m | 6.33 * 10^49 (36^32) | 1 duodecillion years |
  157. // | LINK_32_MIXED_CASE | qf5pqr2UKTUT6vREPPSTuqSKkCMojF17 | 2.69 * 10^56 (58^32) | 4.26 quattuordecillion years |
  158. //
  159. // For any MIXED_CASE variants, upper-case I and lower-case L will not appear
  160. // because they are visually very similar and are easily confused. For the same
  161. // reason, MIXED_CASE and UPPER_CASE variants will not generate 0 and O.
  162. //
  163. // The default value is LINK_4_PLUS_4_UPPER_CASE, which is still considered very
  164. // secure. The bruteforce times in the table below are the average time it would
  165. // take to find a valid sharing link, when there is one link active, at 1000
  166. // guesses per second. For the default setting, this means it would take almost
  167. // 45 years to find the link.
  168. //
  169. // This is assuming that the link is active 24/7 for that entire time. If you
  170. // only have a link active 2% of the time, it would take over 2200 years.
  171. //
  172. // At 1000 guesses per second, you will likely notice that your server is
  173. // noticeably slower and rapidly filling up with access logs.
  174. //
  175. // Very long links are also time-consuming to type, should you find yourself
  176. // in need of typing in a link manually on another computer. This is the reason
  177. // that short links are default.
  178. //
  179. // ---- PLEASE NOTE ----
  180. // This option is provided to you only because several people have requested it
  181. // as a convenience. You are free to change it, but you should know that
  182. // changing the default here gives you, for all intents and purposes, no
  183. // security advantage in practice.
  184. //
  185. "link_style" => LINK_4_PLUS_4_UPPER_CASE,
  186. // Leaflet tile URI template for the map frontend. Here are some examples:
  187. //
  188. // - OpenStreetMap directly:
  189. // https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png
  190. // - Mapbox:
  191. // https://api.tiles.mapbox.com/v4/mapbox.streets/{z}/{x}/{y}.png?access_token=YOUR_ACCESS_TOKEN
  192. // - Thunderforest:
  193. // https://{s}.tile.thunderforest.com/neighbourhood/{z}/{x}/{y}.png?apikey=YOUR_API_KEY
  194. // - Esri:
  195. // https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}
  196. // - OpenMapSurfer:
  197. // https://maps.heigit.org/openmapsurfer/tiles/roads/webmercator/{z}/{x}/{y}.png
  198. // - Hydda (OSM Sweden):
  199. // https://{s}.tile.openstreetmap.se/hydda/full/{z}/{x}/{y}.png
  200. //
  201. // Make sure you have permission to use the source you choose, and also use a
  202. // proper attribution for that provider.
  203. "map_tile_uri" => 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
  204. // Attribution HTML code to be displayed in the bottom right corner of the map.
  205. // The default value is suitable for OpenStreetMap tiles.
  206. "map_attribution" => 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>',
  207. // Default and maximum zoom levels allowed on the map (0-20), higher value means
  208. // closer zooming.
  209. "default_zoom" => 14,
  210. "max_zoom" => 19,
  211. // Maximum duration of a single location share, in seconds.
  212. "max_duration" => 86400,
  213. // Minimum time between each location update, in seconds.
  214. "min_interval" => 1,
  215. // The time that should pass without any location updates received, in seconds,
  216. // before the user is marked "offline" on the map.
  217. "offline_timeout" => 30,
  218. // The timeout in seconds for map update requests from the map view. If a web
  219. // request takes this long without a response, the map viewer is considered
  220. // offline and will get a warning notifying them that they have lost their
  221. // network connection.
  222. "request_timeout" => 10,
  223. // Maximum number of data points stored for each share before old points are
  224. // deleted. Map clients will see up to this amount of data points when they load
  225. // the page.
  226. "max_cached_pts" => 3,
  227. // Maximum number of data points that may be visible on the map at any time.
  228. // This is used to draw trails behind the current location map marker. Higher
  229. // values will show longer trails, but may reduce performance.
  230. "max_shown_pts" => 100,
  231. // Number of seconds of data that should be used to calculate velocity.
  232. "v_data_points" => 2,
  233. // The color of the marker trails. HTML color name or #rrggbb hex color code.
  234. "trail_color" => '#d80037',
  235. // The unit of measurement of velocity. Valid are:
  236. // KILOMETERS_PER_HOUR, MILES_PER_HOUR, METERS_PER_SECOND
  237. "velocity_unit" => MILES_PER_HOUR,
  238. // The publicly accessible URL to reach Hauk, with trailing slash.
  239. "public_url" => 'https://geoloc.unbl.ink/'
  240. );