通过telnet登录varnish管理缓存时依赖认证,如下

# telnet 127.0.0.1 3500

Trying 127.0.0.1...

Connected to 127.0.0.1.

Escape character is '^]'.

107 59      

wubsamypvocpwqiyobfbyvjkarclhebd

Authentication required.


解决方法:

再打开一个窗口

cat > a                           ########任意文件名

wubsamypvocpwqiyobfbyvjkarclhebd

abfef98a-ddfe-4f52-9c56-72e942f7516d

wubsamypvocpwqiyobfbyvjkarclhebd

^D


中间的“abfef98a-ddfe-4f52-9c56-72e942f7516d”是/etc/sysconfig/varnish中VARNISH_SECRET_FILE项所指定的密码文件的内容

# hexdump -C a

00000000  77 75 62 73 61 6d 79 70  76 6f 63 70 77 71 69 79  |wubsamypvocpwqiy|

00000010  6f 62 66 62 79 76 6a 6b  61 72 63 6c 68 65 62 64  |obfbyvjkarclhebd|

00000020  0a 61 62 66 65 66 39 38  61 2d 64 64 66 65 2d 34  |.abfef98a-ddfe-4|

00000030  66 35 32 2d 39 63 35 36  2d 37 32 65 39 34 32 66  |f52-9c56-72e942f|

00000040  37 35 31 36 64 0a 77 75  62 73 61 6d 79 70 76 6f  |7516d.wubsamypvo|

00000050  63 70 77 71 69 79 6f 62  66 62 79 76 6a 6b 61 72  |cpwqiyobfbyvjkar|

00000060  63 6c 68 65 62 64 0a                              |clhebd.|

00000067


# sha256sum a

52fdafa732c90573a06a33587e048512598d43f25b2a3001fd247d05ebeb49ad  a


在telnet上输入


Authentication required.


auth 52fdafa732c90573a06a33587e048512598d43f25b2a3001fd247d05ebeb49ad

200 203    

-----------------------------

Varnish Cache CLI 1.0

-----------------------------

Linux,2.6.32-71.el6.i686,i686,-sfile,-smalloc,-hcritbit


Type 'help' for command list.

Type 'quit' to close CLI session.



认证通过。



官方给出的CLI相关文档:

https://www.varnish-cache.org/docs/3.0/reference/varnish-cli.html