# 鉴权服务

# 部署要求

  1. 需要提供部署鉴权服务的机器id。不同公有云获取机器id方法不同。
  2. 需要提供https证书。
  3. 需要保证web端可以访问到鉴权服务
  4. 需要保证合成服务可以访问到鉴权服务
  5. 需要保证鉴权服务可以访问到外网

# 需要的文件

文件描述 文件名 文件位置
鉴权器 NvAuthenticator /opt/authserver/bin
授权文件 bseditor.lic /opt/authserver/resources
https证书私钥和公钥 [域名].crt
[域名].key
/opt/cert/
配置文件 config.json /opt/authserver/resources

# 部署的目录结构

之后的证书建议统一配置在/opt/cert 下,可能和图片中的不符合。

# 配置文件示例:

DEFAULT_SSL_PORT: 注意不能用非ssl的端口 MAX_GOROUTINE: 默认协程数量

{
  "DEFAULT_SSL_PORT": ":7443",					
  "SSL_PEM_FILE_PATH": "/opt/cert/1_eapi.meishesdk.com_bundle.crt",
  "SSL_KEY_FILE_PATH": "/opt/cert/2_eapi.meishesdk.com.key",
  "LICENSE_FILE_PATH": "/opt/authserver/resources/bseditor.lic",
  "MAX_GOROUTINE": 200,
  "LOG_CONFIG_FILE_PATH": "/opt/auth-server/resources/config.yaml"
}

# 日志文件 config.yaml

config.yaml需要放置到resource目录下

#zap logger configuration
zap:
  #可使用 "debug", "info", "warn", "error", "dpanic", "panic", "fatal",
  level: 'info'
  #console: 控制台, json: json格式输出
  format: 'console'
  prefix: '[NV]'
  director: '/opt/authserver/log'
  linkName: 'latest_log'
  showLine: true
  #LowercaseLevelEncoder:小写, LowercaseColorLevelEncoder:小写带颜色,CapitalLevelEncoder: 大写, CapitalColorLevelEncoder: 大写带颜色,
  encodeLevel: 'LowercaseColorLevelEncoder'
  stacktraceKey: 'stacktrace'
  logInConsole: true

# 运行**

# 阿里云服务器
cd /opt/authserver/bin
setsid ./NvAuthenticator  -c /opt/authserver/resources/config.json -t aliyun &

# 腾讯云服务器
cd /opt/authserver/bin
setsid ./NvAuthenticator  -c /opt/authserver/resources/config.json -t tencentyun &

# 华为云服务器
cd /opt/authserver/bin
setsid ./NvAuthenticator  -c /opt/authserver/resources/config.json -t huaweiyun &

# 机器码为Mac地址的服务器
cd /opt/authserver/bin
setsid ./NvAuthenticator  -c /opt/authserver/resources/config.json -t bilibili &

# 机器ID的生成方式

lic生成的时候需要提供机器ID

虚机类型 机器ID获取方式
阿里云 在虚机上运行
wget http://100.100.100.200/latest/meta-data/instance-id (opens new window)
腾讯云 wget http://metadata.tencentyun.com/latest/meta-data/uuid (opens new window)
华为云 wget http://169.254.169.254/openstack/latest/meta_data.json (opens new window)
其他 虚机的mac地址(鉴权服务器)

#

# 测试

# 运行查看,如果有返回结果,就说明部署正确
wget https://<host:port>/app/test