# 为 Artifactory 启用 SSL

## 步骤

1. 生成 CA 密钥。
   ```
   openssl genrsa -out local.key 2040
   Generating RSA private key, 2040 bit long modulus (2 primes)
   ..............................+++++
   .......+++++
   e is 65537 (0x010001)
   ```

   已生成 local.key 文件。
2. 生成 CA 证书请求。
   ```
   ➜ zhengshu openssl req -new-key local.key -out local.csr
   req: Unrecognized flag new-key
   req: Use -help for summary.
   ➜ zhengshu openssl req -new -key local.key -out local.csr
   You are about to be asked to enter information that will be incorporated
   into your certificate request.
   What you are about to enter is what is called a Distinguished Name or a DN.
   There are quite a few fields but you can leave some blank
   For some fields there will be a default value,
   If you enter '.', the field will be left blank.
   -----
   Country Name (2 letter code) [AU]:FR
   State or Province Name (full name) [Some-State]:FR
   Locality Name (eg, city) []:Surness
   Organization Name (eg, company) [Internet Widgits Pty Ltd]:Talend
   Organizational Unit Name (eg, section) []:Developer
   Common Name (e.g. server FQDN or YOUR name) []:RD
   Email Address []:aa@talend.com
    
   Please enter the following 'extra' attributes
   to be sent with your certificate request
   A challenge password []:tacadmin
   An optional company name []:tac
   ```

   已生成 local.csr 文件。
3. 生成 CA 根证书。
   ```
   openssl x509 -req -in local.csr -extensions v3_ca -signkey local.key -out local.crt
   Signature ok
   subject=C = FR, ST = FR, L = Surness, O = Talend, OU = Developer, CN = RD, emailAddress = aa@talend.com
   Getting Private key
   ➜ zhengshu l
   total 20K
   drwxrwxr-x 2 oem oem 4.0K 11月 9 16:06 .
   drwxr-xr-x 44 oem oem 4.0K 11月 9 16:06 ..
   -rw-rw-r-- 1 oem oem 1.3K 11月 9 16:06 local.crt
   -rw-rw-r-- 1 oem oem 1.1K 11月 9 16:04 local.csr
   -rw------- 1 oem oem 1.7K 11月 9 16:02 local.key
   ➜ zhengshu openssl genrsa -out my_server.key 2040
   Generating RSA private key, 2040 bit long modulus (2 primes)
   ...................+++++
   ..........+++++
   e is 65537 (0x010001)
   ```

   已生成 local.crt 文件。
4. 在 Artifactory 中配置自定义几处 URL。
   1. 在 Admin 页签中，选择 Configuration &gt; General &gt; Custom Base URL。
   2. 在 Custom Base URL 文本框中填写访问 Artifactory 的 URL。例如：https://yourdomain.com。

   有关配置基础 URL 的更多信息，参阅 https://www.jfrog.com/confluence/display/JFROG/General+System+Settings （仅提供英文版本）。