config.php 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495
  1. <?php
  2. /**
  3. * HSDN PHP Whois Server Daemon
  4. *
  5. * @author HSDN Team
  6. * @copyright (c) 2015, Information Networks Ltd.
  7. * @link http://www.hsdn.org
  8. */
  9. // This line can not be deleted!
  10. namespace pWhoisd;
  11. return [
  12. // Daemon configuration
  13. 'daemon' =>
  14. [
  15. // Server listen IP address
  16. 'listen_address' => '0.0.0.0',
  17. // Server listen IPv6 address
  18. 'listen_address_ipv6' => '',
  19. // Server listen port
  20. 'listen_port' => 43,
  21. // Max server worker processes
  22. 'workers' => 300,
  23. ],
  24. // Logging configuration
  25. 'logging' =>
  26. [
  27. // Log severity (Log::debug, Log::info, Log::warning, Log::error)
  28. 'severity' => Log::debug,
  29. // Log file path (e.g. ./pwhoisd.log)
  30. 'file' => FALSE,
  31. ],
  32. // Security configuration
  33. 'security' =>
  34. [
  35. // List of access rules
  36. // Warning! By default all connections are allowed and no limits do not apply.
  37. //
  38. // Access rule format:
  39. // ['ACTION'(, 'MESSAGE')(, ['VARIABLE', 'OPERATOR', 'VALUE/UNIT'])(, ['VARIABLE', 'OPERATOR', 'VALUE/UNIT'])(, ...)]
  40. //
  41. // ACTION:
  42. // allow Permit a client connections and requests
  43. // deny Print specified message to a client (optional) and drop the connection
  44. // drop Silently drop a client connection. No messages is sent
  45. //
  46. // VARIABLE:
  47. // client_ip Client connection IP address (used for IP/subnets checks)
  48. // requests Used to specify a requests rate limit to the specific client connections
  49. // rate Used to specify the global server requests rate limit for all clients connections
  50. //
  51. // MESSAGE:
  52. // Here specify the name of the section in the messages array configuration.
  53. //
  54. // OPERATOR:
  55. // Any one of the allowed operators. Not to be used in IP rules. The allowed operators are:
  56. // < Less than
  57. // == Equal to
  58. // <= Less than or equal to
  59. // > Greater than
  60. // >= Greater than or equal to
  61. //
  62. // VALUE:
  63. // For requests rate rules specifies a numeric value with UNIT (see below).
  64. // It can also be a single IP address (subnet, in CIDR format) or an array of IP addresses (subnets).
  65. //
  66. // UNIT:
  67. // Any one of the allowed units. Not to be used in IP rules. The allowed units are:
  68. // sec Second(s)
  69. // hr Hour(s)
  70. // min Minute(s)
  71. // day Day(s)
  72. //
  73. 'rules' =>
  74. [
  75. // Drop all connections if server rate more 20 requests per one seconds
  76. // This rule will work with the previous rules (sets a global server rate limits).
  77. ['drop', ['rate', '>', '20/sec']],
  78. // Allow all connections from IP 127.0.0.1.
  79. // It is owerride previous (bottom) 'deny' rule for this IP (limits do not works)
  80. ['allow', ['client_ip', '127.0.0.1'] ],
  81. // Deny any client if rate more 50 requests per one minute.
  82. ['deny', 'limit_exceeded', ['requests', '>', '50/min']],
  83. // Permit all connections (it is first rule).
  84. ['allow'],
  85. ],
  86. ],
  87. // Messages configuration (use empty quotes to set <CR><LF>)
  88. //
  89. // This variables is available to use in all messages:
  90. // {_request_} Current request string
  91. // {_client_ip_} Current client IP address
  92. // {_client_port_} Current client port number
  93. // {%...%} Includes other message context (for example: {%header%})
  94. // {...} Includes any data-field value
  95. //
  96. 'messages' =>
  97. [
  98. //
  99. // Global messages
  100. //
  101. // Limit exceeded response message
  102. 'limit_exceeded' =>
  103. [
  104. 'Whois limit exceeded.',
  105. ],
  106. // Access denied response message
  107. 'access_denied' =>
  108. [
  109. 'Access denied.',
  110. ],
  111. //
  112. // RIPN's style messages
  113. //
  114. // Whois response header fragment
  115. 'header_ripn' =>
  116. [
  117. '% By submitting a query to RIPN\'s Whois Service',
  118. '% you agree to abide by the following terms of use:',
  119. '% http://www.ripn.net/about/servpol.html#3.2 (in Russian)',
  120. '% http://www.ripn.net/about/en/servpol.html#3.2 (in English).',
  121. '', // <CR><LF>
  122. ],
  123. // Whois response footer fragment
  124. 'footer_ripn' =>
  125. [
  126. '', // <CR><LF>
  127. 'Last updated on {updated_new}',
  128. ],
  129. //
  130. // PIR's style messages
  131. //
  132. // Whois response footer fragment
  133. 'footer_pir' =>
  134. [
  135. '', // <CR><LF>
  136. 'Access to Public Interest Registry WHOIS information is provided to assist persons in determining the contents of a domain name registration record in the Public Interest Registry registry database. The data in this record is provided by Public Interest Registry for informational purposes only, and Public Interest Registry does not guarantee its accuracy. This service is intended only for query-based access. You agree that you will use this data only for lawful purposes and that, under no circumstances will you use this data to(a) allow, enable, or otherwise support the transmission by e-mail, telephone, or facsimile of mass unsolicited, commercial advertising or solicitations to entities other than the data recipient\'s own existing customers; or (b) enable high volume, automated, electronic processes that send queries or data to the systems of Registry Operator, a Registrar, or Afilias except as reasonably necessary to register domain names or modify existing registrations. All rights reserved. Public Interest Registry reserves the right to modify these terms at any time. By submitting this query, you agree to abide by this policy. For more information on Whois status codes, please visit https://www.icann.org/resources/pages/epp-status-codes-2014-06-16-en.',
  137. ],
  138. ],
  139. // Data configuration (first entry is default)
  140. 'data' =>
  141. [
  142. // Domain (RIPN's style)
  143. [
  144. // Request flag or key
  145. 'flag' => '-R domain',
  146. // Storage configuration
  147. 'storage' =>
  148. [
  149. // Storage type (mysql)
  150. 'type' => 'mysql',
  151. // MySQL storage configuration
  152. 'db_host' => 'localhost',
  153. 'db_port' => 3306,
  154. 'db_user' => 'pwhoisd',
  155. 'db_pass' => 'J35tn4fFhEB7YJ6B',
  156. 'db_name' => 'pwhoisd',
  157. // Database SQL queries (uses first row of query result)
  158. //
  159. // This variables is available to use in queries (use variable {_request_} to specify request string):
  160. // {_request_} Current request string
  161. // {_client_ip_} Current client IP address
  162. // {_client_port_} Current client port number
  163. // {...} Includes any data-field value from previous query results (uses first rows)
  164. // Warning! Value of all variabled are automate escaped.
  165. //
  166. 'queries' =>
  167. [
  168. // Fetch last database update timestamp
  169. 'SELECT MAX(`updated`) AS `updated` FROM `domain_ripn`',
  170. // Search and fetch row by request
  171. 'SELECT * FROM `domain_ripn` WHERE `domain` LIKE \'{_request_}\' LIMIT 1',
  172. ],
  173. ],
  174. // Formatting data in fields (overrides or creates fields)
  175. // The variables is specified in the following format: {VARIABLE}.
  176. // Warning! Value of all variables are automate quoted (uses double quotes).
  177. 'format' =>
  178. [
  179. // Create new field 'updated_new' based on date-formatted field 'updated'
  180. ['updated_new', 'date("Y.m.d H:i:s \M\S\K", strtotime({updated}))'],
  181. // Format date fields
  182. ['created', 'date("Y.m.d", strtotime({created}))'],
  183. ['paid_till', 'date("Y.m.d", strtotime({paid_till}))'],
  184. ['free_date', 'date("Y.m.d", strtotime({free_date}))'],
  185. // Example: hide 'admin_contact' field if not exists flag '-L' in request
  186. ['admin_contact_new', '{admin_contact}'],
  187. ['admin_contact', NULL],
  188. ['admin_contact', '{admin_contact_new}', '-L'],
  189. // Make a domain field uppercase
  190. ['domain', 'strtoupper({domain})'],
  191. ],
  192. // Enable fields message space padding (uses only for ['MESSAGE', 'FIELD'] entries)
  193. //
  194. // Example #1 (no padding):
  195. // ...
  196. // domain:HSDN.RU
  197. // nserver:ns1.hsdn.org.
  198. // org:OOO "Informacionnye Seti"
  199. // ...
  200. //
  201. // Example #2 (with padding):
  202. // ...
  203. // domain: HSDN.RU
  204. // nserver: ns1.hsdn.org.
  205. // org: OOO "Informacionnye Seti"
  206. // ...
  207. //
  208. 'spacing' => TRUE,
  209. // Enables empty (not NULL) fields hidding
  210. // Note: Fields contains NULL values are hidden anyway.
  211. 'hide_empty' => TRUE,
  212. // Response data fields entries (use empty entry array to set <CR><LF>)
  213. //
  214. // Entries format:
  215. // [('MESSAGE')(, 'FIELD')(, 'FLAG')]
  216. //
  217. // MESSAGE:
  218. // The message for the data-field or any other text. Any variables allowed (see. above).
  219. // Note: Can insert padding before the data values, use the option 'spacing'.
  220. //
  221. // FIELD:
  222. // The name of existing the data-field name or new formatted field (see. above).
  223. //
  224. // FLAG:
  225. // NULL Entry is shown if the data-field exists and is not empty.
  226. // The value of the data-field is inserted after the text (by default).
  227. //
  228. // TRUE Entry shown only if there is a field exists and data not empty.
  229. // The value of the field data is not inserted.
  230. //
  231. // FALSE Entry shown only if there is no a field or data is empty.
  232. // The value of the field data is not inserted.
  233. 'fields' =>
  234. [
  235. // Header message anchor
  236. ['{%header_ripn%}'],
  237. // This text shown only an empty data-field 'domain'
  238. ['No entries found for the selected source(s).', 'domain', FALSE],
  239. // Fields below are only shown if exists and data not empty
  240. ['domain', 'domain'],
  241. ['nserver', 'nserver1'],
  242. ['nserver', 'nserver2'],
  243. ['nserver', 'nserver3'],
  244. ['nserver', 'nserver4'],
  245. ['state', 'state'],
  246. ['person', 'person'],
  247. ['org', 'org'],
  248. ['registrar', 'registrar'],
  249. ['admin-contact', 'admin_contact'],
  250. ['descr', 'descr'],
  251. ['created', 'created'],
  252. ['paid-till', 'paid_till'],
  253. ['free-date', 'free_date'],
  254. ['source', 'source'],
  255. // Footer message anchor (always shown, even if the result is empty)
  256. ['{%footer_ripn%}'],
  257. ],
  258. // Invalid request message
  259. 'invalid_request'=>
  260. [
  261. '{%header_ripn%}',
  262. 'Invalid request.',
  263. ],
  264. ],
  265. // Domain (PIR's style)
  266. [
  267. 'flag' => 'pir',
  268. 'storage' =>
  269. [
  270. 'type' => 'mysql',
  271. 'db_host' => 'localhost',
  272. 'db_port' => 3306,
  273. 'db_user' => 'pwhoisd',
  274. 'db_pass' => 'J35tn4fFhEB7YJ6B',
  275. 'db_name' => 'pwhoisd',
  276. 'queries' =>
  277. [
  278. // Fetch domain information
  279. 'SELECT * FROM `domain_pir` WHERE `DomainName` LIKE \'{_request_}\' LIMIT 1',
  280. // Fetch registrant contact
  281. 'SELECT
  282. `ID` AS `RegistrantID`,
  283. `Name` AS `RegistrantName`,
  284. `Organization` AS `RegistrantOrganization`,
  285. `Street` AS `RegistrantStreet`,
  286. `City` AS `RegistrantCity`,
  287. `StateProvince` AS `RegistrantStateProvince`,
  288. `PostalCode` AS `RegistrantPostalCode`,
  289. `Country` AS `RegistrantCountry`,
  290. `Phone` AS `RegistrantPhone`,
  291. `PhoneExt` AS `RegistrantPhoneExt`,
  292. `Fax` AS `RegistrantFax`,
  293. `FaxExt` AS `RegistrantFaxExt`,
  294. `Email` AS `RegistrantEmail`
  295. FROM `contact_pir` WHERE `ID` = \'{RegistrantID}\' LIMIT 1',
  296. // Fetch admin contact
  297. 'SELECT
  298. `ID` AS `AdminID`,
  299. `Name` AS `AdminName`,
  300. `Organization` AS `AdminOrganization`,
  301. `Street` AS `AdminStreet`,
  302. `City` AS `AdminCity`,
  303. `StateProvince` AS `AdminStateProvince`,
  304. `PostalCode` AS `AdminPostalCode`,
  305. `Country` AS `AdminCountry`,
  306. `Phone` AS `AdminPhone`,
  307. `PhoneExt` AS `AdminPhoneExt`,
  308. `Fax` AS `AdminFax`,
  309. `FaxExt` AS `AdminFaxExt`,
  310. `Email` AS `AdminEmail`
  311. FROM `contact_pir` WHERE `ID` = \'{AdminID}\' LIMIT 1',
  312. // Fetch tech contact
  313. 'SELECT
  314. `ID` AS `TechID`,
  315. `Name` AS `TechName`,
  316. `Organization` AS `TechOrganization`,
  317. `Street` AS `TechStreet`,
  318. `City` AS `TechCity`,
  319. `StateProvince` AS `TechStateProvince`,
  320. `PostalCode` AS `TechPostalCode`,
  321. `Country` AS `TechCountry`,
  322. `Phone` AS `TechPhone`,
  323. `PhoneExt` AS `TechPhoneExt`,
  324. `Fax` AS `TechFax`,
  325. `FaxExt` AS `TechFaxExt`,
  326. `Email` AS `TechEmail`
  327. FROM `contact_pir` WHERE `ID` = \'{TechID}\' LIMIT 1',
  328. ],
  329. ],
  330. 'format' =>
  331. [
  332. ['CreationDate', 'date("Y-m-d\TH:i:s\Z", strtotime({CreationDate}))'],
  333. ['UpdatedDate', 'date("Y-m-d\TH:i:s\Z", strtotime({UpdatedDate}))'],
  334. ['RegistryExpiryDate', 'date("Y-m-d\TH:i:s\Z", strtotime({RegistryExpiryDate}))'],
  335. ['DSCreated1', 'date("Y-m-d\TH:i:s\Z", strtotime({DSCreated1}))'],
  336. ['DSCreated2', 'date("Y-m-d\TH:i:s\Z", strtotime({DSCreated2}))'],
  337. ],
  338. 'spacing' => FALSE,
  339. 'hide_empty' => FALSE,
  340. 'fields' =>
  341. [
  342. ['Domain Name', 'DomainName'],
  343. ['Domain ID', 'DomainID'],
  344. ['Creation Date', 'CreationDate'],
  345. ['Updated Date', 'UpdatedDate'],
  346. ['Registry Expiry Date', 'RegistryExpiryDate'],
  347. ['Trademark Name', 'TrademarkName'],
  348. ['Trademark Date', 'TrademarkDate'],
  349. ['Trademark Country', 'TrademarkCountry'],
  350. ['Trademark Number', 'TrademarkNumber'],
  351. ['Sponsoring Registrar', 'SponsoringRegistrar'],
  352. ['Sponsoring Registrar IANA ID', 'SponsoringRegistrarIANAID'],
  353. ['WHOIS Server', 'WHOISServer'],
  354. ['Referral URL', 'ReferralURL'],
  355. ['Domain Status', 'DomainStatus'],
  356. ['Registrant ID', 'RegistrantID'],
  357. ['Registrant Name', 'RegistrantName'],
  358. ['Registrant Organization', 'RegistrantOrganization'],
  359. ['Registrant Street', 'RegistrantStreet'],
  360. ['Registrant City', 'RegistrantCity'],
  361. ['Registrant State/Province', 'RegistrantStateProvince'],
  362. ['Registrant Postal Code', 'RegistrantPostalCode'],
  363. ['Registrant Country', 'RegistrantCountry'],
  364. ['Registrant Phone', 'RegistrantPhone'],
  365. ['Registrant Phone Ext', 'RegistrantPhoneExt'],
  366. ['Registrant Fax', 'RegistrantFax'],
  367. ['Registrant Fax Ext', 'RegistrantFaxExt'],
  368. ['Registrant Email', 'RegistrantEmail'],
  369. ['Admin ID', 'AdminID'],
  370. ['Admin Name', 'AdminName'],
  371. ['Admin Organization', 'AdminOrganization'],
  372. ['Admin Street', 'AdminStreet'],
  373. ['Admin City', 'AdminCity'],
  374. ['Admin State/Province', 'AdminStateProvince'],
  375. ['Admin Postal Code', 'AdminPostalCode'],
  376. ['Admin Country', 'AdminCountry'],
  377. ['Admin Phone', 'AdminPhone'],
  378. ['Admin Phone Ext', 'AdminPhoneExt'],
  379. ['Admin Fax', 'AdminFax'],
  380. ['Admin Fax Ext', 'AdminFaxExt'],
  381. ['Admin Email', 'AdminEmail'],
  382. ['Tech ID', 'TechID'],
  383. ['Tech Name', 'TechName'],
  384. ['Tech Organization', 'TechOrganization'],
  385. ['Tech Street', 'TechStreet'],
  386. ['Tech City', 'TechCity'],
  387. ['Tech State/Province', 'TechStateProvince'],
  388. ['Tech Postal Code', 'TechPostalCode'],
  389. ['Tech Country', 'TechCountry'],
  390. ['Tech Phone', 'TechPhone'],
  391. ['Tech Phone Ext', 'TechPhoneExt'],
  392. ['Tech Fax', 'TechFax'],
  393. ['Tech Fax Ext', 'TechFaxExt'],
  394. ['Tech Email', 'TechEmail'],
  395. ['Name Server', 'NameServer1'],
  396. ['Name Server', 'NameServer2'],
  397. ['Name Server', 'NameServer3'],
  398. ['Name Server', 'NameServer4'],
  399. ['Name Server', 'NameServer5'],
  400. ['Name Server', 'NameServer6'],
  401. ['Name Server', 'NameServer7'],
  402. ['Name Server', 'NameServer8'],
  403. ['Name Server', 'NameServer9'],
  404. ['Name Server', 'NameServer10'],
  405. ['Name Server', 'NameServer11'],
  406. ['Name Server', 'NameServer12'],
  407. ['Name Server', 'NameServer13'],
  408. ['DNSSEC', 'DNSSEC'],
  409. ['DS Created 1', 'DSCreated1'],
  410. ['DS Key Tag 1', 'DSKeyTag1'],
  411. ['Algorithm 1', 'Algorithm1'],
  412. ['Digest Type 1', 'DigestType1'],
  413. ['Digest 1', 'Digest1'],
  414. ['DS Maximum Signature Life 1', 'DSMaximumSignatureLife1'],
  415. ['DS Created 2', 'DSCreated2'],
  416. ['DS Key Tag 2', 'DSKeyTag2'],
  417. ['Algorithm 2', 'Algorithm2'],
  418. ['Digest Type 2', 'DigestType2'],
  419. ['Digest 2', 'Digest2'],
  420. ['DS Maximum Signature Life 2', 'DSMaximumSignatureLife2'],
  421. // This text shown only an empty data-field 'DomainName'
  422. ['NOT FOUND', 'DomainName', FALSE],
  423. // Footer message anchor (shown only if the data-field 'DomainName' is exists and not empty)
  424. ['{%footer_pir%}', 'DomainName', TRUE],
  425. ],
  426. 'invalid_request' =>
  427. [
  428. '{%header_ripn%}',
  429. 'Invalid request.',
  430. ],
  431. ],
  432. // Help
  433. [
  434. 'flag' => 'help',
  435. 'fields' =>
  436. [
  437. ['{%header_ripn%}'],
  438. ['This is help!'],
  439. ],
  440. ],
  441. ],
  442. ];
  443. // end of config