Browse Source

Better and more concise logging

new-scoring
aeris 2 years ago
parent
commit
5dbf67e0d0
1 changed files with 10 additions and 10 deletions
  1. 10
    10
      lib/cryptcheck/tls/server.rb

+ 10
- 10
lib/cryptcheck/tls/server.rb View File

@@ -192,19 +192,19 @@ module CryptCheck
192 192
 			def connect(&block)
193 193
 				socket   = ::Socket.new @family, sock_type
194 194
 				sockaddr = ::Socket.sockaddr_in @port, @ip
195
-				Logger.trace { "Connecting to #{@ip}:#{@port}" }
195
+				#Logger.trace { "Connecting to #{@ip}:#{@port}" }
196 196
 				begin
197 197
 					status = socket.connect_nonblock sockaddr
198
-					Logger.trace { "Connecting to #{@ip}:#{@port} status : #{status}" }
198
+					#Logger.trace { "Connecting to #{@ip}:#{@port} status : #{status}" }
199 199
 					raise ConnectionError, status unless status == 0
200
-					Logger.trace { "Connected to #{@ip}:#{@port}" }
200
+					#Logger.trace { "Connected to #{@ip}:#{@port}" }
201 201
 					block_given? ? block.call(socket) : nil
202 202
 				rescue ::IO::WaitReadable
203
-					Logger.trace { "Waiting for read to #{@ip}:#{@port}" }
203
+					#Logger.trace { "Waiting for read to #{@ip}:#{@port}" }
204 204
 					raise Timeout, "Timeout when connect to #{@ip}:#{@port} (max #{TCP_TIMEOUT.humanize})" unless IO.select [socket], nil, nil, TCP_TIMEOUT
205 205
 					retry
206 206
 				rescue ::IO::WaitWritable
207
-					Logger.trace { "Waiting for write to #{@ip}:#{@port}" }
207
+					#Logger.trace { "Waiting for write to #{@ip}:#{@port}" }
208 208
 					raise Timeout, "Timeout when connect to #{@ip}:#{@port} (max #{TCP_TIMEOUT.humanize})" unless IO.select nil, [socket], nil, TCP_TIMEOUT
209 209
 					retry
210 210
 				ensure
@@ -215,17 +215,17 @@ module CryptCheck
215 215
 			def ssl_connect(socket, context, method, &block)
216 216
 				ssl_socket          = ::OpenSSL::SSL::SSLSocket.new socket, context
217 217
 				ssl_socket.hostname = @hostname if @hostname and method != :SSLv2
218
-				Logger.trace { "SSL connecting to #{name}" }
218
+				#Logger.trace { "SSL connecting to #{name}" }
219 219
 				begin
220 220
 					ssl_socket.connect_nonblock
221
-					Logger.trace { "SSL connected to #{name}" }
221
+					#Logger.trace { "SSL connected to #{name}" }
222 222
 					return block_given? ? block.call(ssl_socket) : nil
223 223
 				rescue ::OpenSSL::SSL::SSLErrorWaitReadable
224
-					Logger.trace { "Waiting for SSL read to #{name}" }
224
+					#Logger.trace { "Waiting for SSL read to #{name}" }
225 225
 					raise TLSTimeout, "Timeout when TLS connect to #{@ip}:#{@port} (max #{SSL_TIMEOUT.humanize})" unless IO.select [ssl_socket], nil, nil, SSL_TIMEOUT
226 226
 					retry
227 227
 				rescue ::OpenSSL::SSL::SSLErrorWaitWritable
228
-					Logger.trace { "Waiting for SSL write to #{name}" }
228
+					#Logger.trace { "Waiting for SSL write to #{name}" }
229 229
 					raise TLSTimeout, "Timeout when TLS connect to #{@ip}:#{@port} (max #{SSL_TIMEOUT.humanize})" unless IO.select nil, [ssl_socket], nil, SSL_TIMEOUT
230 230
 					retry
231 231
 				rescue ::OpenSSL::SSL::SSLError => e
@@ -269,7 +269,7 @@ module CryptCheck
269 269
 				#ecdh = OpenSSL::PKey::EC.new('sect163r1').generate_key
270 270
 				#ssl_context.tmp_ecdh_callback = proc { ecdh }
271 271
 
272
-				Logger.trace { "Try #{method} connection with #{ciphers}" }
272
+				Logger.trace { "Try method=#{method} / ciphers=#{ciphers} / curves=#{curves} / scsv=#{fallback}" }
273 273
 				connect do |socket|
274 274
 					ssl_connect socket, ssl_context, method do |ssl_socket|
275 275
 						return block_given? ? block.call(ssl_socket) : nil

Loading…
Cancel
Save