Solaris 11 で sslscan をビルドするメモ
sslscan はSSL/TLSのサーバに対してプロトコルやCipherのチェックができるツールです。脆弱なCipherが有効になっていないかなどを手軽にチェックするのに役立ちます。
Solaris 11 でもビルドできたので手順をメモしておきます。sslscan は頻繁にバージョンアップされているので、できるだけ最新版を使うのがよいと思います。
ビルド
gitでリポジトリをクローンします。
$ git clone https://github.com/rbsec/sslscan $ cd sslscan
Makefile を修正します。Solaris では CFLAGS の -m64 と、LIBS の -lsocket を追加する必要がありました。(2017/9/30追記) この修正をマージしてもらったのでもう不要です。
$ diff Makefile.orig Makefile 32,33c32,33 < CFLAGS += -I${PWD}/include/ -I${PWD}/ < LIBS = -lssl -lcrypto -ldl -lz
-
- -
make します。static でビルドすると、OpenSSL の最新版を GitHub からダウンロードしてきてビルドするという漢な仕様になっています。
システムの OpenSSL に依存しないようにスタティックリンクのバイナリができるので、static がおすすめです。また、最近の OpenSSL は SSLv2 がデフォルトで無効になってたりしますが、sslscan の Makefile は、SSLv2 や弱い Cipher も有効になるようになっています。
Solaris だと、OpenSSL が64ビットでビルドされるので、sslscan も -m64 を付ける必要があったので、Makefile を修正しました。(OpenSSLを32ビットでビルドするようにしてもよいですが)
$ CC=gcc make static ...
ビルドに成功すると、sslscan バイナリができるので、make install するか、適当に /usr/local/bin あたりにコピーすれば使えます。
使い方
引数なしで実行すると、ヘルプが表示されます。
$ sslscan _ ___ ___| |___ ___ __ _ _ __ / __/ __| / __|/ __/ _` | '_ \ \__ \__ \ \__ \ (_| (_| | | | | |___/___/_|___/\___\__,_|_| |_| 1.11.4-rbsec-4-g0d2cd58-wip-static OpenSSL 1.0.2h-dev xx XXX xxxx Command: sslscan [Options] [host:port | host] Options: --targets=A file containing a list of hosts to check. Hosts can be supplied with ports (host:port) --ipv4 Only use IPv4 --ipv6 Only use IPv6 --show-certificate Show full certificate information --no-check-certificate Don't warn about weak certificate algorithm or keys --show-client-cas Show trusted CAs for TLS client auth --show-ciphers Show supported client ciphers --show-cipher-ids Show cipher ids --ssl2 Only check SSLv2 ciphers --ssl3 Only check SSLv3 ciphers --tls10 Only check TLSv1.0 ciphers --tls11 Only check TLSv1.1 ciphers --tls12 Only check TLSv1.2 ciphers --tlsall Only check TLS ciphers (all versions) --ocsp Request OCSP response from server --pk= A file containing the private key or a PKCS#12 file containing a private key/certificate pair --pkpass= The password for the private key or PKCS#12 file --certs= A file containing PEM/ASN1 formatted client certificates --no-ciphersuites Do not check for supported ciphersuites --no-renegotiation Do not check for TLS renegotiation --no-compression Do not check for TLS compression (CRIME) --no-heartbleed Do not check for OpenSSL Heartbleed (CVE-2014-0160) --starttls-ftp STARTTLS setup for FTP --starttls-imap STARTTLS setup for IMAP --starttls-irc STARTTLS setup for IRC --starttls-pop3 STARTTLS setup for POP3 --starttls-smtp STARTTLS setup for SMTP --starttls-xmpp STARTTLS setup for XMPP --starttls-psql STARTTLS setup for PostgreSQL --xmpp-server Use a server-to-server XMPP handshake --http Test a HTTP connection --rdp Send RDP preamble before starting scan --bugs Enable SSL implementation bug work-arounds --timeout= Set socket timeout. Default is 3s --sleep= Pause between connection request. Default is disabled --xml= Output results to an XML file --version Display the program version --verbose Display verbose output --no-cipher-details Disable EC curve names and EDH/RSA key lengths output --no-colour Disable coloured output --help Display the help text you are now reading Example: sslscan 127.0.0.1 sslscan [::1]
試しに、Google を調べてみます。
$ sslscan www.google.com Version: 1.11.4-rbsec-4-g0d2cd58-wip-static OpenSSL 1.0.2h-dev xx XXX xxxx Testing SSL server www.google.com on port 443 TLS renegotiation: Secure session renegotiation supported TLS Compression: Compression disabled Heartbleed: TLS 1.2 not vulnerable to heartbleed TLS 1.1 not vulnerable to heartbleed TLS 1.0 not vulnerable to heartbleed Supported Server Cipher(s): Preferred TLSv1.2 128 bits ECDHE-RSA-AES128-GCM-SHA256 Curve P-256 DHE 256 Accepted TLSv1.2 128 bits ECDHE-RSA-AES128-SHA Curve P-256 DHE 256 Accepted TLSv1.2 128 bits ECDHE-RSA-RC4-SHA Curve P-256 DHE 256 Accepted TLSv1.2 128 bits AES128-GCM-SHA256 Accepted TLSv1.2 128 bits AES128-SHA Accepted TLSv1.2 128 bits AES128-SHA256 Accepted TLSv1.2 112 bits DES-CBC3-SHA Accepted TLSv1.2 128 bits RC4-SHA Accepted TLSv1.2 128 bits RC4-MD5 Accepted TLSv1.2 256 bits ECDHE-RSA-AES256-GCM-SHA384 Curve P-256 DHE 256 Accepted TLSv1.2 256 bits ECDHE-RSA-AES256-SHA Curve P-256 DHE 256 Accepted TLSv1.2 256 bits ECDHE-RSA-AES256-SHA384 Curve P-256 DHE 256 Accepted TLSv1.2 128 bits ECDHE-RSA-AES128-SHA256 Curve P-256 DHE 256 Accepted TLSv1.2 256 bits AES256-GCM-SHA384 Accepted TLSv1.2 256 bits AES256-SHA Accepted TLSv1.2 256 bits AES256-SHA256 Preferred TLSv1.1 128 bits ECDHE-RSA-AES128-SHA Curve P-256 DHE 256 Accepted TLSv1.1 128 bits ECDHE-RSA-RC4-SHA Curve P-256 DHE 256 Accepted TLSv1.1 128 bits AES128-SHA Accepted TLSv1.1 112 bits DES-CBC3-SHA Accepted TLSv1.1 128 bits RC4-SHA Accepted TLSv1.1 128 bits RC4-MD5 Accepted TLSv1.1 256 bits ECDHE-RSA-AES256-SHA Curve P-256 DHE 256 Accepted TLSv1.1 256 bits AES256-SHA Preferred TLSv1.0 128 bits ECDHE-RSA-AES128-SHA Curve P-256 DHE 256 Accepted TLSv1.0 128 bits ECDHE-RSA-RC4-SHA Curve P-256 DHE 256 Accepted TLSv1.0 128 bits AES128-SHA Accepted TLSv1.0 112 bits DES-CBC3-SHA Accepted TLSv1.0 128 bits RC4-SHA Accepted TLSv1.0 128 bits RC4-MD5 Accepted TLSv1.0 256 bits ECDHE-RSA-AES256-SHA Curve P-256 DHE 256 Accepted TLSv1.0 256 bits AES256-SHA Preferred SSLv3 128 bits RC4-SHA Accepted SSLv3 128 bits RC4-MD5 Accepted SSLv3 128 bits AES128-SHA Accepted SSLv3 256 bits AES256-SHA Accepted SSLv3 112 bits DES-CBC3-SHA SSL Certificate: Signature Algorithm: sha256WithRSAEncryption RSA Key Strength: 2048 Subject: www.google.com Altnames: DNS:www.google.com Issuer: Google Internet Authority G2 Not valid before: Mar 2 11:08:25 2016 GMT Not valid after: May 31 00:00:00 2016 GMT
Google は SSLv3 と RC4 の廃止を呼びかけてるわりに、まだ SSLv3 も RC4 も MD5 さえも有効なままのようですね。
2017/9/30追記
SolarisでビルドできるようにするMakefileの修正をマージしていただきました。
github.com