Created
October 21, 2016 15:48
-
-
Save tchellomello/103f0a8df6a41066f195c7e8c09628a2 to your computer and use it in GitHub Desktop.
Webrick SSL Tests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
##### | |
##### [root@sat6mmello ~]# openssl s_client -CAfile /etc/foreman-proxy/ssl_ca.pem -connect $(hostname):8444 | |
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'webrick' | |
require 'webrick/https' | |
cert_name = [ | |
%w[CN localhost], | |
] | |
server = WEBrick::HTTPServer.new( | |
:Logger => WEBrick::Log::new($stderr, WEBrick::Log::DEBUG), | |
:Port => 8444, | |
:SSLEnable => true, | |
#:SSLCertName => cert_name, | |
:SSLCertName => [["CN", WEBrick::Utils::getservername]], | |
:SSLVerifyClient => OpenSSL::SSL::VERIFY_NONE, | |
:SSLPrivateKey => OpenSSL::PKey::RSA.new(File.open("/etc/foreman-proxy/ssl_key.pem").read), | |
:SSLCertificate => OpenSSL::X509::Certificate.new(File.open("/etc/foreman-proxy/ssl_cert.pem").read), | |
#:SSLPrivateKey => OpenSSL::PKey::RSA.new(File.open("/etc/foreman-proxy/foreman_ssl_key.pem").read), | |
#:SSLCertificate => OpenSSL::X509::Certificate.new(File.open("/etc/foreman-proxy/foreman_ssl_cert.pem").read), | |
#:SSLPrivateKey => OpenSSL::PKey::RSA.new(File.open("/root/ibm-certs/foreman_ssl_key.pem").read), | |
#:SSLCertificate => OpenSSL::X509::Certificate.new(File.open("/root/ibm-certs/foreman_ssl_cert.pem").read), | |
) | |
server.mount_proc '/' do |req, res| | |
res.body = 'Example Domain Encrypted' | |
end | |
server.start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment