Module: Pipe2me::Tunnel::OpenSSL
- Included in:
- Pipe2me::Tunnel
- Defined in:
- lib/pipe2me/tunnel/openssl.rb
Constant Summary collapse
- HTTP =
Pipe2me::HTTP
- SSL_KEY =
Pipe2me::Tunnel::SSL_KEY
- SSL_CERT =
Pipe2me::Tunnel::SSL_CERT
- SSL_CACERT =
Pipe2me::Tunnel::SSL_CACERT
Instance Method Summary collapse
- #openssl_conf ⇒ Object
-
#ssl_certsign ⇒ Object
send cert signing request to server and receive certificate and root certificate.
-
#ssl_keygen ⇒ Object
create openssl private key and cert signing request.
Instance Method Details
#openssl_conf ⇒ Object
8 9 10 |
# File 'lib/pipe2me/tunnel/openssl.rb', line 8 def openssl_conf File.join(File.dirname(__FILE__), "openssl.conf") end |
#ssl_certsign ⇒ Object
send cert signing request to server and receive certificate and root certificate.
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/pipe2me/tunnel/openssl.rb', line 24 def ssl_certsign cert = HTTP.post!("#{url}/cert.pem", File.read("#{SSL_KEY}.csr"), {'Content-Type' =>'text/plain'}) UI.debug "received certificate:\n#{cert}" File.write SSL_CERT, cert cacert = HTTP.get! "#{Pipe2me.server}/cacert" UI.success "Got #{cacert.length} byte from #{Pipe2me.server}/cacert" File.write SSL_CACERT, cacert end |
#ssl_keygen ⇒ Object
create openssl private key and cert signing request.
13 14 15 16 17 18 19 20 21 |
# File 'lib/pipe2me/tunnel/openssl.rb', line 13 def ssl_keygen sys! "openssl", "req", "-config", openssl_conf, "-new", "-nodes", "-keyout", SSL_KEY, "-out", "#{SSL_KEY}.csr", "-subj", "/C=de/ST=ne/L=Berlin/O=pipe2me/CN=#{config.fqdn}", "-days", "7300" end |