Project

General

Profile

docker and crypt_rn()

Added by Mark Petryk about 2 months ago

I have a project that I am trying to move in to a docker container. The project works great outside the container, and moving inside the container I am finding that my users cannot log in. I traced the routine down to the code found in;

I have found that the hash function is not generating the same hash has the 'non-docker' application.

So, I'm curious... I built my docker container to be essentially the same OS vintage, and gcc compilers and what not to replicate as closely as possible my existing running application, but running in a container, thus making my application more or less portable. But, then this password hash function is failing, and I'm not sure why.

Are there some particulars related to these hash functions that have some kind of dependency on the vintage of the crypto libraries? I'm just not sure how to conclude why these functions are failing to hash.

HashFunction.C (wt-3.7)

132 bool BCryptHashFunction::verify(const std::string& msg,
133                                 const std::string& salt,
134                                 const std::string& hash) const
135 {
136   char result[64];
137 
138   std::cout << __FILE__ << ":" << __LINE__
139     << " msg:" << msg
140     << " salt:" << salt
141     << " hash:" << hash
142     << std::endl;
143 
144   if (!crypt_rn(msg.c_str(), hash.c_str(), result, 64))
145   {
146     std::cout << __FILE__ << ":"  << __LINE__ << " " << std::endl;
147     std::perror("crypt_rn");
148     throw std::runtime_error("bcrypt() internal error");
149   }
150 
151   std::cout << __FILE__ << ":" << __LINE__
152     << " result:" << result
153     << " hash:" << hash
154     << std::endl;
155 
156 
157   return result == hash;
158 }


Replies (1)

    (1-1/1)