nginx auth_basic发送密码明文吗?

我正在用这些说明安装netdata( https://www.digitalocean.com/community/tutorials/how-to-set-up-real-time-performance-monitoring-with-netdata-on-ubuntu-16-04 )

最后它使用htpasswd创build一个用户:密码文件,看起来像是以某种方式进行了散列处理。 如果我看看我看到的文件…

 username:$somekindofpasswordhashandnotthepasswordientered 

然后指示告诉我做一个这样的服务器块…

 server { listen your_server_ip:80; server_name example.com; auth_basic "Authentication Required"; auth_basic_user_file netdata-access; 

netdata-accessnginx conf目录中的密码文件。 所以当我访问这个页面并input密码时,我是否通过networking发送密码明文,或者nginx模块对它进行了哪些encryption? 服务器块在端口80上,而不是443 …

编辑:我快速阅读了这两个东西的文档,我发现没有关于我的问题的信息

auth_basic在连接到服务器时打开的同一个连接上工作,所以在http上使用纯文本,在https上使用SSL / TLS进行加密。 在发送到服务器之前,发生在用户/传递组合上的唯一处理是Base64编码。

您可以使用curl来查看标题:

 $ curl -v -u your_user_name "http://......." 

查找> Authorization: Basic ...行,其中包含user:passBase64编码user:pass

你可以用下面的代码解码字符串

 printf auth_string | base64 --decode 

更多细节在这里 。


关于密码文件, nginx可以在密码文件中使用明文和散列密码( info here ):

1.纯文本:

  # comment name1:password1 name2:password2:comment name3:password3 

2.加密/散列:

  • 用crypt()函数加密; 可以使用Apache HTTP服务器发行版本的“htpasswd”工具生成
    “openssl passwd”命令;

  • 与基于MD5的密码算法(apr1)的Apache变体相混淆; 可以用相同的工具生成;

  • 由RFC 2307中描述的“{scheme} data”语法(1.0.3+)指定; 当前实现的方案包括PLAIN(不应该使用示例),SHA(1.3.13)(不应该使用纯SHA-1哈希)和SSHA(一些软件包使用的SHA-1哈希) OpenLDAP和Dovecot)。

 $ htpasswd Usage: htpasswd [-cimBdpsDv] [-C cost] passwordfile username htpasswd -b[cmBdpsDv] [-C cost] passwordfile username password htpasswd -n[imBdps] [-C cost] username htpasswd -nb[mBdps] [-C cost] username password -c Create a new file. -n Don't update file; display results on stdout. -b Use the password from the command line rather than prompting for it. -i Read password from stdin without verification (for script usage). -m Force MD5 encryption of the password (default). -B Force bcrypt encryption of the password (very secure). -C Set the computing time used for the bcrypt algorithm (higher is more secure but slower, default: 5, valid: 4 to 31). -d Force CRYPT encryption of the password (8 chars max, insecure). -s Force SHA encryption of the password (insecure). -p Do not encrypt the password (plaintext, insecure). -D Delete the specified user. -v Verify password for the specified user. On other systems than Windows and NetWare the '-p' flag will probably not work. The SHA algorithm does not use a salt and is less secure than the MD5 algorithm.