2016-03-15

Add https support to DrillREST

Configuring Web Console and REST API Security 中有提到,

Drill 1.2 uses code-level support for transport layer security (TLS) to secure the Web Console and REST API. By default, the Web Console and REST API support the HTTP protocol. You set the following start-up option to TRUE to enable HTTPS support:

drill.exec.http.ssl_enabled

By default this start-up option is set to FALSE.

Drill generates a self-signed certificate that works with SSL for HTTPS access to the Web Console.

如果使用瀏覽器去連 Web Console,是會有警告的。

我不太確定我是不是有完全做對,但是 Apache Drill 的 SSL_ENABLED 在設定打開以後,使用 tls 套件去連線是可以正確連線的。

    constructor {{SERVER http://localhost:8047} {SSL_ENABLED 0}} {
         set server $SERVER
        set ssl_enabled $SSL_ENABLED

        if {$ssl_enabled} {
            if {[catch {package require tls}]==0} {
                http::register https 443 [list ::tls::socket -ssl3 0 -ssl2 0 -tls1 1]
            } else {
                error "SSL_ENABLED needs package tls..."
            }
        }
     }

重點是 package require tls 和下面一行的設定,就完成了。

沒有留言: