为用户“tomcat”创build本地自签名证书

当我在Ubuntu 15.04上安装Tomcat 8时,我使用以下命令来创build用户“tomcat”:

sudo adduser \ --system \ --shell /bin/bash \ --gecos 'Tomcat Java Servlet and JSP engine' \ --group \ --disabled-password \ --home /home/tomcat \ tomcat 

因此,我没有密码。 现在我需要生成一个CSR,以便在Tomcat 8上安装SSL证书。为此,我正在使用本教程 。

在运行命令keytool -genkey -alias tomcat -keyalg RSA -keystore <your_keystore_filename>它将为用户“tomcat”请求密码。 我试过击ENTER,但它不工作。

我该怎么办?

那么我不认为keytool命令是问你的密码为tomcat用户。 生成自签名证书与系统用户无关。 Keytool命令要求您为正在生成的证书设置密码。

 keytool -genkey -alias tomcat -keyalg RSA -keystore /applications/certs/test.key Enter keystore password: Re-enter new password: What is your first and last name? [Unknown]: example.com What is the name of your organizational unit? [Unknown]: test What is the name of your organization? [Unknown]: test What is the name of your City or Locality? [Unknown]: delhi What is the name of your State or Province? [Unknown]: delhi What is the two-letter country code for this unit? [Unknown]: IN Is CN=example.com, OU=test, O=test, L=delhi, ST=delhi, C=IN correct? [no]: yes Enter key password for <tomcat> (RETURN if same as keystore password): Re-enter new password: 

尝试openssl命令行。 你会发现很多创build自签名证书的方法。