Sha256: b68f802498ae54f109c430e99445c2eea56ddc5a4bc3175b636029338b283dd7

Contents?: true

Size: 795 Bytes

Versions: 11

Compression:

Stored size: 795 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)

srv = GSSAPI::Simple.new(host, service, keytab)
srv.acquire_credentials

loop do
  Thread.start(tcpsrv.accept) do |s|
    print(s, "Accepted Connection\n")
    stok = s.gets.chomp
    print(s, "Received string#{stok}\n")
    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

11 entries across 11 versions & 2 rubygems

Version Path
vagrant-tiktalik-0.0.3 vendor/bundle/ruby/2.0.0/gems/gssapi-1.0.3/examples/gss_server.rb
gssapi-1.0.3 examples/gss_server.rb
gssapi-1.0.2 examples/gss_server.rb
gssapi-1.0.1 examples/gss_server.rb
gssapi-1.0.0 examples/gss_server.rb
gssapi-0.1.5 examples/gss_server.rb
gssapi-0.1.4 examples/gss_server.rb
gssapi-0.1.3 examples/gss_server.rb
gssapi-0.1.2 examples/gss_server.rb
gssapi-0.1.0 examples/gss_server.rb
gssapi-0.0.2 examples/gss_server.rb