1
0

config.h 17 KB

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