winexe 1.1 centos 6 and windows 2012 R2

One of the software applications that I use at work relies on a linux uility called “winexe”. It turns out that this particular tool is incompatible with Windows 8.1, 10 and Server 2012R2. This incompability is due to the fact that SMB 1.0 support was removed from these versions of Windows(1), and the tool uses it, so now it doesn’t work.

The major symptom is running the tool and getting the error “NT_STATUS_INVALID_PARAMETER”, but seeing that the authentication is working successfully (I confirmed this by putting in the right + wrong password and noticing the behavior change).

The fine folks over at winexe did release a version 1.1 that fixes this issue. Unfortunately, it has to be statically compiled against Samba, and a specific version at that. This took me several hours to solve, and I drew from several resources to accomplish it. Here is the process I used.

# make sure EPEL is enabled in /etc/yum.repos.d/epel.repo

# fixup a bunch of samba dependencies
yum install gcc perl mingw-binutils-generic mingw-filesystem-base mingw32-binutils mingw32-cpp mingw32-crt mingw32-filesystem mingw32-gcc mingw32-headers mingw64-binutils mingw64-cpp mingw64-crt mingw64-filesystem mingw64-gcc mingw64-headers libcom_err-devel popt-devel zlib-devel zlib-static glibc-devel glibc-static python-devel
yum install git gnutls-devel libacl1-dev libacl-devel libldap2-dev openldap-devel

#per the docs, remove libbsd-devel if installed
yum remove libbsd-devel

#clone the git repos. samba is huge, like 280MB
cd /usr/src
git clone git://git.code.sf.net/p/winexe/winexe-waf winexe-winexe-waf
git clone git://git.samba.org/samba.git samba

#per winexe bug 64, samba needs to be reverted to a6bda1f2bc85779feb9680bc74821da5ccd401c5
#
cd /usr/src/samba
git reset --hard a6bda1f2bc85779feb9680bc74821da5ccd401c5

#fixup the build deps. I chose to build it as big and static as I could, so the only linked dependency is gnutls
# cd /usr/src/winexe-winexe-waf/source
# modify 'wscript_build', and at the very end ...
stlib='smb_static bsd z resolv rt'
lib='dl gnutls'

#build it! this does a huge configure, then also compiles samba, which takes a while.
./waf --samba-dir=../../samba configure build

#executable should be  /usr/src/winexe-winexe-waf/source/build/winexe-static

Plenty of help from the following URLs:
(1) http://sourceforge.net/p/winexe/bugs/30/#a8c8
http://sourceforge.net/p/winexe/bugs/64/
http://sourceforge.net/p/winexe/winexe-waf/ci/master/tree/README
https://www.reddit.com/r/linuxadmin/comments/2xsmge/winexe_1001_for_centos_6_x86_64/cp3a4e8

8 thoughts on “winexe 1.1 centos 6 and windows 2012 R2

  1. Thank you so much for this. Helped a ton!

    There is a very minor typo in your code.
    stlib=’stlib=’smb_static bsd z resolv rt’,
    lib=’dl gnutls’

    Should instead be,
    stlib=’smb_static bsd z resolv rt’,
    lib=’dl gnutls’

  2. I am hitting following error

    Could not find the program i386-mingw32-gcc,i386-mingw32msvc-gcc,i386-w64-mingw32-gcc,i586-mingw32-gcc,i586-mingw32msvc-gcc,i586-w64-mingw32-gcc,i686-mingw32-gcc,i686-mingw32msvc-gcc,i686-w64-mingw32-gcc
    (complete log in /scratch/cjoshi/winexe-waf/source/build/config.log)

    where as these packages are shown as existing..

    not sure whats issue here

  3. This has fixed it. Like you I’d spent hours trying to dig to the bottom of why salt isn’t talking to my Windows 8.1 box. I found most of the bits to the puzzle but without your explanation I wouldn’t’ve succeeded.

    Great work and thanks.

    ps: I did it on Centos 7.2 and all the steps worked perfectly.

Leave a Reply

Your email address will not be published. Required fields are marked *