INSTALL.WINDOWS 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. Before you start
  2. ================
  3. An up to date version of this document can be found online:
  4. https://redmine.openinfosecfoundation.org/projects/suricata/wiki/Windows
  5. Alternatively, an installation document for using CYGWIN instead of MinGW can
  6. be found here:
  7. https://redmine.openinfosecfoundation.org/attachments/download/676/SurWinInstallGuide.pdf
  8. This file describes how to build and run Suricata on Windows. Currently
  9. Windows XP and above are supported.
  10. Preparing the build environment
  11. ===============================
  12. 1. Setup MinGW environment from http://mingw.org
  13. Do not use the automatic installer as it is deprecated. Manually unpack
  14. the following packages to c:\mingw (use newer versions if you like):
  15. * binutils
  16. o binutils-2.20–1-mingw32-bin.tar.gz
  17. * mingw-runtime (dev and dll):
  18. o mingwrt-3.17-mingw32-dll.tar.gz
  19. o mingwrt-3.17-mingw32-dev.tar.gz
  20. * w32api
  21. o w32api-3.14-mingw32-dev.tar.gz
  22. * required runtime libraries for GCC (gmp, libiconv, MPFR and pthreads):
  23. o gmp-4.2.4-mingw32-dll.tar.gz
  24. o libiconv-1.13.1–1-mingw32-dll-2.tar.lzma
  25. o mpfr-2.4.1-mingw32-dll.tar.gz
  26. o pthreads-w32–2.8.0-mingw32-dll.tar.gz
  27. * gcc-core (bin and dll):
  28. o gcc-core-4.4.0-mingw32-bin.tar.gz
  29. o gcc-core-4.4.0-mingw32-dll.tar.gz
  30. * make
  31. o make-3.81–20090914-mingw32-bin.tar.gz
  32. * zlib
  33. o libz-1.2.3-1-mingw32-dll-1.tar.gz
  34. o libz-1.2.3-1-mingw32-dev.tar.gz
  35. 2. Install MSYS
  36. http://sourceforge.net/projects/mingw/files/
  37. MSYS-1.0.11.exe (MSYS Base System)
  38. msysDTK-1.0.1.exe (MSYS Suplementary Tools)
  39. autoconf-2.63–1-msys-1.0.11-bin.tar.lzma
  40. automake-1.11–1-msys-1.0.11-bin.tar.lzma
  41. libtool-2.2.7a-1-msys-1.0.11-bin.tar.lzma
  42. MSYS will ask questions during the installation:
  43. Accept Post Install: [y]
  44. MinGW Installed? : [y]
  45. path to MinGW: [c:/MinGW]
  46. 3. Install pkg-config taken from http://wiki.videolan.org/Win32CompileMSYSNew#PKG-CONFIG
  47. Download and extract the following into c:\Msys\1.0
  48. http://ftp.gnome.org/pub/GNOME/binaries/win32/glib/2.18/glib_2.18.2-1_win32.zip
  49. ftp://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/pkg-config_0.23-3_win32.zip
  50. ftp://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/pkg-config-dev_0.23-3_win32.zip
  51. Set PKG_CONFIG_PATH=/win32/lib/pkgconfig
  52. (e.g. by adding the Windows enviroment variable PKG_CONFIG_PATH in "Control Panel"->"System"->"Advanced System Settings"->"Environment Variables" and setting the value to /win32/lib/pkgconfig)
  53. 4. Get git
  54. Download portable GIT from this URL:
  55. http://code.google.com/p/msysgit/
  56. - unpack to /msys/1.0
  57. - don't forget to edit your ~/.gitconfig to at least give youreself a name :-)
  58. 5. Get libpcre2
  59. http://www.pcre.org/
  60. ./configure --enable-utf8 --disable-cpp --prefix=/mingw
  61. make
  62. make install
  63. 6. Get libyaml
  64. http://pyyaml.org/wiki/LibYAML
  65. It does not support mingw compilation. However it works in static mode:
  66. ./configure --prefix=/mingw CFLAGS="-DYAML_DECLARE_STATIC"
  67. make
  68. make install
  69. 7. Get libpcap
  70. Guide can be found here:
  71. - Download Devlopers pack http://www.winpcap.org/devel.htm
  72. - Download and install a coresponding installer package http://www.winpcap.org/install/default.htm (to have the driver in the system)
  73. - Copy includes to c:/mingw/include and libs (.a) to c:/mingw/lib
  74. - Rename libwpcap to libpcap
  75. 8. Get and compile Suricata
  76. git clone git://phalanx.openinfosecfoundation.org/oisf.git
  77. cd oisf
  78. Because of some weird autools port bug we do the following:
  79. dos2unix.exe libhtp/configure.ac
  80. dos2unix.exe libhtp/htp.pc.in
  81. dos2unix.exe libhtp/Makefile.am
  82. ./autogen.sh
  83. ./configure CFLAGS="-DYAML_DECLARE_STATIC"
  84. # add --enable-nfqueue as parameter to configure to enable inline mode
  85. make
  86. If everything goes well, you'll end up with suricata.exe in src/.lib. To test it
  87. you will need libpcre2-0.dll, libz-1.dll, and pthreadGC2.dll which you already have somewhere
  88. under c:/mingw or c:/msys. To prepare the runtime environment:
  89. - copy the executable and the DLLs to a dedicated directory
  90. - get there classification.config and suricata.yaml
  91. - edit suricata.yaml (at least set the directories correctly)
  92. PCAP Mode
  93. =========
  94. Make sure you have winpcap runtime and driver installed and then:
  95. - determine your eth device UUID in the registry:
  96. HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\
  97. - now cross your fingers and do:
  98. suricata.exe -c suricata.yaml -i \DEVICE\{your device uuid}
  99. Inline Mode
  100. ===========
  101. You need to downoad, compile and install netfilterforwin (the netfilter.sys
  102. driver and Windows port of the libnetfilter_queue library):
  103. 1. Download and install Windows Driver Kit from Microsoft
  104. http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=36a2630f-5d56-43b5-b996-7633f2ec14ff
  105. 2. Download netfilterforwin
  106. http://sourceforge.net/projects/netfilterforwin/
  107. Unpack it so the netfilterforwin directory (omit the version from its name)
  108. is beside the oisf directory.
  109. 3. Compile the driver
  110. - Open the build environment from you Start menu:
  111. Start->All Programs->windows Driver Kits->WDK xxxx.yyyy.z->Build Environments
  112. ->Windows Server 2003->x86 Free Build Environment
  113. (or the one which is proper for your system)
  114. - cd to netfilterforwin/netfilter
  115. - enter command:
  116. nmake
  117. 4. Install the driver
  118. - copy inf/* files and the freshly built netfilter.sys to a separate directory
  119. - open network connecions
  120. - right-click an interface, select properties
  121. - click install...
  122. - select service
  123. - click add
  124. - click 'have disk...'
  125. - browse to the directory with the inf files and netfilter.sys, select netfilter.inf anc click ok
  126. - confirm everything
  127. You should have the driver installed now.
  128. 5. Run Suricata in inline mode:
  129. suricata.exe -c suricata.yaml -q 0