config.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637
  1. #ifndef CONFIG_H_
  2. #define CONFIG_H_
  3. /* Don't change anything ABOVE this line */
  4. /*
  5. * As a best practice do not change the original config.h as distributed with vlmcsd.
  6. * Instead make a copy, e.g. myconfig.h, customize it and type 'make CONFIG=myconfig.h'
  7. * to build vlmcsd. This prevents your copy being overwritten when you upgrade to a
  8. * new version.
  9. */
  10. /*
  11. * ----------------------------------------------------------------------------------------
  12. * Useful customizations. These options are mandatory. You cannot comment them out.
  13. * Feel free to change them to fit your needs.
  14. * ----------------------------------------------------------------------------------------
  15. */
  16. #ifndef VERSION
  17. /*
  18. * Define your own version identifier here, e.g. '#define VERSION "my vlmcsd based on svn560"'
  19. */
  20. #define VERSION "private build"
  21. #endif // VERSION
  22. /*
  23. * Define default ePIDs and HWID here. Preferrably grab ePIDs and HWID
  24. * from a real KMS server.
  25. */
  26. #ifndef EPID_WINDOWS
  27. #define EPID_WINDOWS "03612-00206-471-494932-03-1033-14393.0000-2382016"
  28. #endif
  29. #ifndef EPID_OFFICE2010
  30. #define EPID_OFFICE2010 "03612-00096-199-954738-03-1033-14393.0000-2382016"
  31. #endif
  32. #ifndef EPID_OFFICE2013
  33. #define EPID_OFFICE2013 "03612-00206-234-177489-03-1033-14393.0000-2382016"
  34. #endif
  35. #ifndef EPID_OFFICE2016
  36. #define EPID_OFFICE2016 "03612-00206-437-728387-03-1033-14393.0000-2382016"
  37. #endif
  38. #ifndef HWID // HwId from the Ratiborus VM
  39. #define HWID 0x36, 0x4F, 0x46, 0x3A, 0x88, 0x63, 0xD3, 0x5F
  40. #endif
  41. /*
  42. * Anything below this line is optional. If you want to use any of these options
  43. * uncomment one or more lines starting with "//#define"
  44. */
  45. /*
  46. * -------------------------------
  47. * Defaults
  48. * -------------------------------
  49. */
  50. #ifndef INI_FILE
  51. /*
  52. * Uncomment and customize the following line if you want vlmcsd to look for an ini file
  53. * at a default location
  54. */
  55. //#define INI_FILE "/etc/vlmcsd.ini"
  56. #endif // INI_FILE
  57. /*
  58. * ----------------------------------------------------------------------------------------
  59. * Troubleshooting options. Please note that disabling features may also help troubleshooting.
  60. * If you have an old OS that does not support features like pthreads, shared memory or
  61. * semaphores, uncomment "#define NO_LIMIT" and "#define NO_SIGHUP" and leave "#define USE_THREADS"
  62. * commented out.
  63. * ----------------------------------------------------------------------------------------
  64. */
  65. #ifndef CHILD_HANDLER
  66. /*
  67. * Uncomment the following #define if you are compiling for a platform that does
  68. * not correctly handle the SA_NOCLDWAIT flag when ignoring SIGCHLD, i.e. forked
  69. * processes remain as "zombies" after dying. This option will add a SIGCHLD handler that
  70. * "waits" for a child that has terminated. This is only required for a few
  71. * unixoid OSses.
  72. */
  73. //#define CHILD_HANDLER
  74. #endif // CHILD_HANDLER
  75. #ifndef NO_TIMEOUT
  76. /*
  77. * Uncomment the following #define if you are compiling for a platform that does
  78. * not support custom socket send or receive timeouts.
  79. */
  80. //#define NO_TIMEOUT
  81. #endif // NO_TIMEOUT
  82. #ifndef NO_DNS
  83. /*
  84. * Uncomment the following #define if you have trouble with accessing routines
  85. * from libresolv. If enabled, vlmcs will be compiled without support for
  86. * detecting KMS servers via DNS.
  87. */
  88. //#define NO_DNS
  89. #endif // NO_DNS
  90. #ifndef TERMINAL_FIXED_WIDTH
  91. /*
  92. * Uncomment the following #define and optionally change its value if you are compiling for
  93. * a platform that cannot properly determine the width of a terminal/command prompt.
  94. * This affects the output of "vlmcsd -x" only. It should be rarely necessary to use this.
  95. */
  96. //#define TERMINAL_FIXED_WIDTH 80
  97. #endif // TERMINAL_FIXED_WIDTH
  98. #ifndef _PEDANTIC
  99. /*
  100. * Uncomment the following #define if you want to do vlmcs and vlmcsd more checks on the data
  101. * it receives over the network. They are normally not necessary but may provide useful if
  102. * you are testing any KMS server or client emulator that may send malformed KMS packets.
  103. */
  104. //#define _PEDANTIC
  105. #endif // _PEDANTIC
  106. #ifndef NO_PROCFS
  107. /*
  108. * Cygwin, Linux, Android, NetBSD, DragonflyBSD:
  109. * Do not rely on a properly mounted proc filesystem and use the less reliable
  110. * argv[0] to determine the program's executable name when restarting vlmcsd
  111. * by sending a SIGHUP signal. Use only if absolutely necessary (very old versions
  112. * of these OSses).
  113. *
  114. * FreeBSD:
  115. * Do not use sysctl and but the less reliable
  116. * argv[0] to determine the program's executable name when restarting vlmcsd
  117. * by sending a SIGHUP signal. Use only if absolutely necessary (very old FreeBSD).
  118. *
  119. * OpenBSD:
  120. * This option has no effect since OpenBSD always must use the less reliable argv[0].
  121. *
  122. * Mac OS X, Solaris:
  123. * This option is not neccessary (and has no effect) since these OSses provide
  124. * a reliable way to determine the executable name.
  125. *
  126. * Windows:
  127. * This option is not used because Windows doesn't support signals.
  128. */
  129. //#define NO_PROCFS
  130. #endif // NO_PROCFS
  131. #ifndef USE_AUXV
  132. /*
  133. * Linux only:
  134. * Use the process' ELF aux vector to determine the executable name when restarting
  135. * vlmcsd by sending a SIGHUP signal. This is actually the best method but is supported
  136. * only with
  137. * * the musl library
  138. * * the glbic library 2.16 or newer
  139. *
  140. * It does NOT work with uclibc (most routers and other small devices) and glibc < 2.16.
  141. * Use it only if your system supports it and you do not plan to use the binary on older systems.
  142. * It won't work on debian 7 or Red Hat 6.x.
  143. *
  144. * It it safe to try this by yourself. vlmcsd won't compile if your system doesn't support it.
  145. */
  146. //#define USE_AUXV
  147. #endif // USE_AUXV
  148. #ifndef _OPENSSL_NO_HMAC
  149. /*
  150. * If you configured vlmcsd to use OpenSSL (which you shouldn't) you may use this option
  151. * to calculate the KMSv6 HMAC with internal code instead of using OpenSSL.
  152. *
  153. * This may be necessary for some embedded devices that have OpenSSL without HMAC support.
  154. */
  155. //#define _OPENSSL_NO_HMAC
  156. #endif // _OPENSSL_NO_HMAC
  157. /*
  158. * ----------------------------------------------------------------------------------------
  159. * Modes of operation
  160. * ----------------------------------------------------------------------------------------
  161. */
  162. #ifndef USE_THREADS
  163. /*
  164. * Do not use fork() but threads to serve your clients.
  165. *
  166. * Unix-like operarting systems:
  167. * You may use this or not. Entirely your choice. Threads do not require explicitly allocating
  168. * a shared memory segment which might be a problem on some systems. Using fork() is more robust
  169. * although the threaded version of vlmcsd is rock solid too.
  170. *
  171. * Some older unixoid OSses may not have pthreads. Do NOT use USE_THREADS and define NO_SIGHUP
  172. * and NO_LIMIT instead to disable use of the pthreads, shared memory and semaphores.
  173. *
  174. * Cygwin:
  175. * It is recommended to use threads since fork() is extremely slow (no copy on write) and somewhat
  176. * unstable.
  177. *
  178. * Windows:
  179. * This option has no effect since fork() is not supported.
  180. */
  181. //#define USE_THREADS
  182. #endif // USE_THREADS
  183. #ifndef _CRYPTO_POLARSSL
  184. /*
  185. * Not available on native Windows. Can be used with Cygwin.
  186. *
  187. * Use PolarSSL for crypto routines if possible and if it is safe. There is not much benefit by using this
  188. * options since it can be used for SHA256 and HMAC_SHA256 only. It cannot be used for AES calculations because
  189. * KMSv6 uses a modified algorithm that PolarSSL does not support. KMSv4 CMAC is also unsupported since it uses
  190. * a Rijndael keysize (160 bits) that is not part of the AES standard.
  191. *
  192. * It is strongly recommended not to use an external crypto library.
  193. *
  194. * Do not define both _CRYPTO_OPENSSL and _CRYPTO_POLARSSL
  195. */
  196. //#define _CRYPTO_POLARSSL
  197. #endif // _CRYPTO_POLARSSL
  198. #ifndef _CRYPTO_OPENSSL
  199. /*
  200. * Not available on native Windows. Can be used with Cygwin.
  201. *
  202. * Use OpenSSL for crypto routines if possible and if it is safe. There is not much benefit by using this
  203. * options since it can be used for SHA256 and HMAC_SHA256 only. It cannot be used for AES calculations because
  204. * KMSv6 uses a modified algorithm that OpenSSL does not support. KMSv4 CMAC is also unsupported since it uses
  205. * a Rijndael keysize (160 bits) that is not part of the AES standard.
  206. *
  207. * It is strongly recommended not to use an external crypto library.
  208. *
  209. * Do not define both _CRYPTO_OPENSSL and _CRYPTO_POLARSSL
  210. */
  211. //#define _CRYPTO_OPENSSL
  212. #endif // _CRYPTO_OPENSSL
  213. #ifndef _USE_AES_FROM_OPENSSL
  214. /*
  215. * DANGEROUS: Tweak OpenSSL to perform KMSv4 CMAC and KMSv6 modified AES. This option creates the expanded
  216. * AES key by itself and then applies modifications to it. OpenSSL will then perfom modified AES operations.
  217. *
  218. * This options tampers with internal structures of OpenSSL that are subject to change or may have a platform
  219. * specific implementation. In this case your resulting binary can only perform KMSv5 operations.
  220. *
  221. * This option has no effect if _CRYPTO_OPENSSL is not defined.
  222. *
  223. * Don't use this except for your own research on the internals of OpenSSL.
  224. */
  225. //#define _USE_AES_FROM_OPENSSL
  226. #endif // _USE_AES_FROM_OPENSSL
  227. #ifndef _OPENSSL_SOFTWARE
  228. /*
  229. * Use this only if you have defined _CRYPTO_OPENSSL and _USE_AES_FROM_OPENSSL. It has no effect otherwise.
  230. *
  231. * This options assumes a different internal AES expanded key in OpenSSL which is used mostly if OpenSSL is
  232. * compiled without support for hardware accelerated AES. It's worth a try if _USE_AES_FROM_OPENSSL doesn't work.
  233. */
  234. //#define _OPENSSL_SOFTWARE
  235. #endif // _OPENSSL_SOFTWARE
  236. /*
  237. * ------------------------------------------------------------------------------------------
  238. * Extra features not compiled by default because they are rarely needed
  239. * ------------------------------------------------------------------------------------------
  240. */
  241. #ifndef INCLUDE_BETAS
  242. /*
  243. * Uncomment the following #define if you want obsolete beta/preview SKUs
  244. * to be included in the extended product list.
  245. */
  246. //#define INCLUDE_BETAS
  247. #endif
  248. /*
  249. * ----------------------------------------------------------------------------------------
  250. * Removal of features. Allows you to remove features of vlmcsd you do not need or want.
  251. * Use it to get smaller binaries. This is especially useful on very small embedded devices.
  252. * ----------------------------------------------------------------------------------------
  253. */
  254. #ifndef NO_FREEBIND
  255. /*
  256. * Do not compile support for FREEBIND (Linux) and IP_BINDANY (FreeBSD). This disables the -F1 command
  257. * line option and you can bind only to (listen on) IP addresses that are currently up and running on
  258. * your system.
  259. */
  260. //#define NO_FREEBIND
  261. #endif // NO_FREEBIND
  262. #ifndef NO_EXTENDED_PRODUCT_LIST
  263. /*
  264. * Do not compile the extended product list. Removes the list of Activation GUIDs (aka
  265. * Client SKU Id, License Id) and their respective product names (e.g. Windows 8.1 Enterprise).
  266. *
  267. * This affects logging only and does not have an effect on activation itself. As long as you
  268. * do not also define NO_BASIC_PRODUCT_LIST more generic names like Windows 8.1 or Office 2013
  269. * will still be logged. Saves a lot of space without loosing much functionality.
  270. *
  271. */
  272. //#define NO_EXTENDED_PRODUCT_LIST
  273. #endif // NO_EXTENDED_PRODUCT_LIST
  274. #ifndef NO_BASIC_PRODUCT_LIST
  275. /*
  276. * Do not compile the basic product list. Removes the list KMS GUIDs (aka Server SKU Id) and their
  277. * respective product names. Only affects logging not activation. This has a negative impact only
  278. * if you activate a product that is not (yet) in the extended product list. On the other hand you
  279. * do not save much space by not compiling this list.
  280. */
  281. //#define NO_BASIC_PRODUCT_LIST
  282. #endif // NO_BASIC_PRODUCT_LIST
  283. #ifndef NO_VERSION_INFORMATION
  284. /*
  285. * Removes the -V option from vlmcsd and vlmcs that displays the version information
  286. */
  287. //#define NO_VERSION_INFORMATION
  288. #endif // NO_VERSION_INFORMATION
  289. #ifndef NO_VERBOSE_LOG
  290. /*
  291. * Removes the ability to do verbose logging and disables -v and -q in vlmcsd. It does not remove the -v
  292. * option in the vlmcs client. Disables ini file directive LogVerbose.
  293. */
  294. //#define NO_VERBOSE_LOG
  295. #endif // NO_VERBOSE_LOG
  296. #ifndef NO_LOG
  297. /*
  298. * Disables logging completely. You can neither log to a file nor to the console. -D and -f will
  299. * start vlmcsd in foreground. -e will not be available. Disables ini file directive LogFile.
  300. * Implies NO_VERBOSE_LOG, NO_EXTENDED_PRODUCT_LIST and NO_BASIC_PRODUCT_LIST.
  301. */
  302. //#define NO_LOG
  303. #endif // NO_LOG
  304. #ifndef NO_RANDOM_EPID
  305. /*
  306. * Disables the ability to generate random ePIDs. Useful if you managed to grab ePID/HWID from a
  307. * real KMS server and want to use these. Removes -r from the vlmcsd command line and the ini
  308. * file directive RandomizationLevel (The randomization level will be harcoded to 0).
  309. */
  310. //#define NO_RANDOM_EPID
  311. #endif // NO_RANDOM_EPID
  312. #ifndef NO_INI_FILE
  313. /*
  314. * Disables the ability to use a configuration file (aka ini file). Removes -i from the command line.
  315. */
  316. //#define NO_INI_FILE
  317. #endif // NO_INI_FILE
  318. #ifndef NO_PID_FILE
  319. /*
  320. * Disables the abilty to write a pid file containing the process id of vlmcsd. If your init system
  321. * does not need this feature, you can safely disables this but it won't save much space. Disables
  322. * the use of -p from the command line and PidFile from the ini file.
  323. */
  324. //#define NO_PID_FILE
  325. #endif // NO_PID_FILE
  326. #ifndef NO_USER_SWITCH
  327. /*
  328. * Disables switching to another uid and/or gid after starting the program and setting up the sockets.
  329. * You cannot use -u anf -g on the command line as well as User and Group in the ini file. If your init system
  330. * supports starting daemons as another uid/gid (user/group) you can disable this feature in vlmcsd as long as you
  331. * do not need to run vlmcsd on a privileged port ( < 1024 on most systems).
  332. *
  333. * This setting has no effect on native Windows since -u and -g is not available anyway. It may be used with
  334. * Cygwin.
  335. */
  336. //#define NO_USER_SWITCH
  337. #endif // NO_USER_SWITCH
  338. #ifndef NO_HELP
  339. /*
  340. * Disables display of help in both vlmcsd and vlmcs. Saves some bytes but only makes sense if you have
  341. * access to the man files vlmcsd.8 and vlmcs.1
  342. */
  343. //#define NO_HELP
  344. #endif // NO_HELP
  345. #ifndef NO_CUSTOM_INTERVALS
  346. /*
  347. * Disables the ability to specify custom interval for renewing and retrying activation. Newer versions of the Microsoft's
  348. * KMS activation client (as in Win 8.1) do not honor these parameters anyway. Disable them to save some bytes. Removes
  349. * -A and -R from the command line as well as ActivationInterval and RenewalInterval in the ini file.
  350. */
  351. //#define NO_CUSTOM_INTERVALS
  352. #endif // NO_CUSTOM_INTERVALS
  353. #ifndef NO_PRIVATE_IP_DETECT
  354. /*
  355. * Disables the ability to protect vlmcsd against KMS requests from public IP addresses.
  356. * Removes -o from the command line.
  357. */
  358. //#define NO_PRIVATE_IP_DETECT
  359. #endif // NO_PRIVATE_IP_DETECT
  360. #ifndef NO_SOCKETS
  361. /*
  362. * Disables standalone startup of vlmcsd. If you use this config directive, you must start vlmcsd from an internet
  363. * superserver like inetd, xinetd, systemd or launchd. Disables -m, -t, -4, -6, -e, -f, -P and -L in the vlmcsd
  364. * command line. Socket setup is the job of your superserver.
  365. */
  366. //#define NO_SOCKETS
  367. #endif // NO_SOCKETS
  368. #ifndef NO_CL_PIDS
  369. /*
  370. * Disables the ability to specify ePIDs and HWID at the command line. You still may use them in the ini file.
  371. * Removes -0, -3, -w and -H from the vlmcsd command line.
  372. */
  373. //#define NO_CL_PIDS
  374. #endif // NO_CL_PIDS
  375. #ifndef NO_LIMIT
  376. /*
  377. * Disables the ability to limit the number of worker threads or processes that vlmcsd uses. While you should set a
  378. * limit whenever possible, you may save some bytes by enabling that setting. If you do not use a limit, use vlmcsd
  379. * in a "friendly" environment only, i.e. do not run it without a reasonable limit on the internet.
  380. *
  381. * Removes the ability to use -m in the vlmcsd command line and MaxWorkers in the ini file.
  382. *
  383. * Some older unixoid OSses may not have pthreads. Do NOT use USE_THREADS and define NO_SIGHUP
  384. * and NO_LIMIT instead to disable use of the pthreads, shared memory and semaphores.
  385. */
  386. //#define NO_LIMIT
  387. #endif // NO_LIMIT
  388. #ifndef NO_SIGHUP
  389. /*
  390. * Disables the ability to signal hangup (SIGHUP) to vlmcsd to restart it (rereading the ini file). The SIGHUP
  391. * handler makes heavy use of OS specific code. It should not cause any trouble on Solaris, Mac OS X and iOS. On Linux
  392. * use "#define USE_AUXV" (see troubleshooting options) if this is supported by your C runtime library.
  393. *
  394. * You may save some bytes by enabling this option. Use it also if the SIGHUP handler causes any trouble on your
  395. * platform. Please note that with no SIGHUP handler at all. vlmcsd will simply terminate (uncleanly) if it receives
  396. * the SIGHUP signal. This is the same behavior as with most other signals.
  397. *
  398. * This option has no effect on native Windows since Posix signaling is not supported. It can be used with Cygwin.
  399. */
  400. //#define NO_SIGHUP
  401. #endif // NO_SIGHUP
  402. #ifndef SIMPLE_SOCKETS
  403. /*
  404. * Disables the ability to choose IP addresses using the -L option in vlmcsd. vlmcsd will listen on all IP addresses.
  405. * It still supports IPv4 and IPv6.
  406. */
  407. //#define SIMPLE_SOCKETS
  408. #endif // SIMPLE_SOCKETS
  409. /* Don't change anything BELOW this line */
  410. #endif /* CONFIG_H_ */