Sha256: 700b0a76f420b78e3bce480592126ec0d9465b0f2d5bb3d026c24bacfbc5a081

Contents?: true

Size: 802 Bytes

Versions: 55

Compression:

Stored size: 802 Bytes

Contents

require 'gssapi'
require 'base64'
require 'socket'


host = 'example.org'
service  = 'host'
keytab = "#{ENV['HOME']}/.gssapi/krb5.keytab"  # this is optional, but probably required if not running as root

tcpsrv = TCPServer.new(host, 8082)

loop do
  Thread.start(tcpsrv.accept) do |s|
    print(s, "Accepted Connection\n")
    stok = s.gets.chomp
    print(s, "Received string#{stok}\n")
    srv = GSSAPI::Simple.new(host, service, keytab)
    srv.acquire_credentials
    otok = srv.accept_context(Base64.strict_decode64(stok.chomp))
    s.write("#{Base64.strict_encode64(otok)}\n")

    begin
      emsg = s.gets.chomp
      msg = srv.unwrap_message(Base64.strict_decode64(emsg.chomp))
      puts "Received: #{msg}"
    end while msg != 'exit'

    print(s, "Closing Socket\n")
    s.close
  end
end

Version data entries

55 entries across 46 versions & 5 rubygems

Version Path
vagrant-unbundled-2.2.19.0 vendor/bundle/ruby/3.0.0/gems/gssapi-1.3.1/examples/gss_server.rb
vagrant-unbundled-2.2.18.0 vendor/bundle/ruby/3.0.0/gems/gssapi-1.3.1/examples/gss_server.rb
vagrant-unbundled-2.2.16.0 vendor/bundle/ruby/3.0.0/gems/gssapi-1.3.1/examples/gss_server.rb
vagrant-unbundled-2.2.16.0 vendor/bundle/ruby/2.7.0/gems/gssapi-1.3.1/examples/gss_server.rb
vagrant-unbundled-2.2.14.0 vendor/bundle/ruby/2.7.0/gems/gssapi-1.3.1/examples/gss_server.rb
gssapi-1.3.1 examples/gss_server.rb
vagrant-unbundled-2.2.10.0 vendor/bundle/ruby/2.7.0/gems/gssapi-1.3.0/examples/gss_server.rb
vagrant-unbundled-2.2.9.0 vendor/bundle/ruby/2.7.0/gems/gssapi-1.3.0/examples/gss_server.rb
vagrant-unbundled-2.2.8.0 vendor/bundle/ruby/2.7.0/gems/gssapi-1.3.0/examples/gss_server.rb
vagrant-unbundled-2.2.7.0 vendor/bundle/ruby/2.6.0/gems/gssapi-1.3.0/examples/gss_server.rb
vagrant-unbundled-2.2.7.0 vendor/bundle/ruby/2.4.0/gems/gssapi-1.2.0/examples/gss_server.rb
vagrant-unbundled-2.2.7.0 vendor/bundle/ruby/2.7.0/gems/gssapi-1.3.0/examples/gss_server.rb
vagrant-unbundled-2.2.6.2 vendor/bundle/ruby/2.6.0/gems/gssapi-1.3.0/examples/gss_server.rb
vagrant-unbundled-2.2.6.1 vendor/bundle/ruby/2.6.0/gems/gssapi-1.3.0/examples/gss_server.rb
vagrant-unbundled-2.2.6.0 vendor/bundle/ruby/2.6.0/gems/gssapi-1.3.0/examples/gss_server.rb
vagrant-unbundled-2.2.5.0 vendor/bundle/ruby/2.6.0/gems/gssapi-1.2.0/examples/gss_server.rb
vagrant-unbundled-2.2.5.0 vendor/bundle/ruby/2.6.0/gems/gssapi-1.3.0/examples/gss_server.rb
vagrant-unbundled-2.2.5.0 vendor/bundle/ruby/2.5.0/gems/gssapi-1.2.0/examples/gss_server.rb
gssapi-1.3.0 examples/gss_server.rb
vagrant-unbundled-2.2.4.0 vendor/bundle/ruby/2.6.0/gems/gssapi-1.2.0/examples/gss_server.rb