From 8bc0752b553956dff9d99a698e1091f1cf501724 Mon Sep 17 00:00:00 2001 From: Oleg Hasjanov Date: Tue, 8 Jun 2021 12:37:22 +0300 Subject: [PATCH 1/2] changed domain version --- lib/epp/server.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/epp/server.rb b/lib/epp/server.rb index 4725b2d..98815c9 100644 --- a/lib/epp/server.rb +++ b/lib/epp/server.rb @@ -27,7 +27,7 @@ def initialize(attributes = {}) @server = attributes[:server] @port = attributes[:port] || 700 @lang = attributes[:lang] || "en" - @services = attributes[:services] || ["urn:ietf:params:xml:ns:domain-1.0", "urn:ietf:params:xml:ns:contact-1.0", "urn:ietf:params:xml:ns:host-1.0"] + @services = attributes[:services] || ["urn:ietf:params:xml:ns:domain-1.1", "urn:ietf:params:xml:ns:contact-1.0", "urn:ietf:params:xml:ns:host-1.0"] @extensions = attributes[:extensions] || [] @version = attributes[:version] || "1.0" @cert = attributes[:cert] || nil @@ -157,7 +157,7 @@ def login login << services = Node.new("svcs") - services << Node.new("objURI", "urn:ietf:params:xml:ns:domain-1.0") + services << Node.new("objURI", "urn:ietf:params:xml:ns:domain-1.1") services << Node.new("objURI", "urn:ietf:params:xml:ns:contact-1.0") services << Node.new("objURI", "urn:ietf:params:xml:ns:host-1.0") From f0890f26c008a8fc3ba9338830b29a2cda65be24 Mon Sep 17 00:00:00 2001 From: olegphenomenon Date: Wed, 22 Mar 2023 14:40:17 +0200 Subject: [PATCH 2/2] turn off socket cert connection --- lib/epp/server.rb | 53 +++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 44 insertions(+), 9 deletions(-) diff --git a/lib/epp/server.rb b/lib/epp/server.rb index 98815c9..8a63888 100644 --- a/lib/epp/server.rb +++ b/lib/epp/server.rb @@ -27,7 +27,7 @@ def initialize(attributes = {}) @server = attributes[:server] @port = attributes[:port] || 700 @lang = attributes[:lang] || "en" - @services = attributes[:services] || ["urn:ietf:params:xml:ns:domain-1.1", "urn:ietf:params:xml:ns:contact-1.0", "urn:ietf:params:xml:ns:host-1.0"] + @services = attributes[:services] || ["urn:ietf:params:xml:ns:domain-1.0", "urn:ietf:params:xml:ns:contact-1.0", "urn:ietf:params:xml:ns:host-1.0"] @extensions = attributes[:extensions] || [] @version = attributes[:version] || "1.0" @cert = attributes[:cert] || nil @@ -78,19 +78,42 @@ def send_request(xml) # established, then this method will call get_frame and return # the EPP frame which is sent by the # server upon connection. + # def open_connection + # @connection = TCPSocket.new(server, port) + # @context = OpenSSL::SSL::SSLContext.new + # @context.cert = @cert + # @context.key = @key + + # @socket = OpenSSL::SSL::SSLSocket.new(@connection, @context) if @connection + # @socket.sync_close = true + # @socket.connect + + # get_frame + # end def open_connection @connection = TCPSocket.new(server, port) - @context = OpenSSL::SSL::SSLContext.new - @context.cert = @cert - @context.key = @key - @socket = OpenSSL::SSL::SSLSocket.new(@connection, @context) if @connection - @socket.sync_close = true - @socket.connect + puts "@connection #{@connection}" + puts "@cert #{@cert}" + puts "@key #{@key}" + + if @cert && @key + @context = OpenSSL::SSL::SSLContext.new + @context.cert = @cert + @context.key = @key + + @socket = OpenSSL::SSL::SSLSocket.new(@connection, @context) + @socket.sync_close = true + @socket.connect + else + @socket = @connection + end + + puts "@@socket #{@socket }" get_frame end - + # Closes the connection to the EPP server. def close_connection @socket.close if @socket and not @socket.closed? @@ -106,14 +129,26 @@ def close_connection # the connection is broken, a SocketError will be raised. Otherwise, # it will return a string containing the XML from the server. def get_frame + puts "@socket get frame" + puts @socket + puts @socket.eof? + puts '====' raise SocketError.new("Connection closed by remote server") if !@socket or @socket.eof? header = @socket.read(4) + puts "headers" + puts header + puts "---------" + raise SocketError.new("Error reading frame from remote server") if header.nil? length = header_size(header) + puts "length" + puts length + puts '=========' + raise SocketError.new("Got bad frame header length of #{length} bytes from the server") if length < 5 return @socket.read(length - 4) @@ -157,7 +192,7 @@ def login login << services = Node.new("svcs") - services << Node.new("objURI", "urn:ietf:params:xml:ns:domain-1.1") + services << Node.new("objURI", "urn:ietf:params:xml:ns:domain-1.0") services << Node.new("objURI", "urn:ietf:params:xml:ns:contact-1.0") services << Node.new("objURI", "urn:ietf:params:xml:ns:host-1.0")