Tinyproxy支持权限校验Basic HTTP Authentication

简介: Tinyproxy支持权限校验Basic HTTP Authentication

tinyproxy版本1.8.3不支持账号密码验证,而新版本1.10.0支持


1、如果不需要鉴权,可以直接通过yum安装1.8版本


2、需要鉴权则要使用1.10版本,yum安装的最新版是1.8,只能通过源码安装


一、yum安装1.8.3

# 安装
$ yum install tinyproxy
$ tinyproxy -v
tinyproxy 1.8.3
# 启动 start|stop|status|restart
$ service tinyproxy start
# 卸载
$ yum erase tinyproxy

二、编译安装1.10.0

下载安装包页面

https://github.com/tinyproxy/tinyproxy/releases


找到最新版本

Version 1.10.0 (2020-05-20)


看到新版本的介绍,已经增加了验证


Add support for basic HTTP authentication

1、安装最新版


wget https://github.com/tinyproxy/tinyproxy/releases/download/1.10.0/tinyproxy-1.10.0.tar.gz
tar -zxvf tinyproxy-1.10.0.tar.gz
cd tinyproxy-1.10.0
# 编译安装
./configure && 
make && 
make install
$ which tinyproxy
/usr/local/bin/tinyproxy
$ tinyproxy -v
tinyproxy 1.10.0

如果发现tinyproxy的版本没有变化,则删除文件重新进行编译安装


2、修改配置

/etc/tinyproxy/tinyproxy.conf


# 注释掉这行,允许所有ip访问
# Allow 127.0.0.1
# 权限校验
BasicAuth user 123456

如果配置文件不存在,则搜索一下配置文件路径


$ find / -name tinyproxy.conf
# 拷贝一份配置文件
$ cp tinyproxy.conf /etc/tinyproxy/tinyproxy.conf

3、启动


# 启动(不采用后台启动,方便调试)
$ tinyproxy -d -c /etc/tinyproxy/tinyproxy.conf
# 指定配置文件启动(后台启动)
$ tinyproxy -c /etc/tinyproxy/tinyproxy.conf
# 杀掉进程
$ ps -ef|grep tinyproxy|grep -v grep|awk '{print "kill -9 "$2}'|sh

4、测试


# 不加验证参数不会正常返回
$ curl -x http://127.0.0.1:8888 www.baidu.com
Proxy Authentication Required
# 正常返回
$ curl -x http://user:123456@127.0.0.1:8888 www.baidu.com

遇到的问题

1、之前通过yum安装过1.8版本,又通过编译安装了1.10版本,版本号没有变化

解决:

将tinyproxy彻底删除后重新编译安装


$ find / -name tinyproxy

2、配置文件不生效

看下是不是有多份配置文件,最好通过-c指定配置文件


附:启动关闭管理脚本 service.sh


#!/bin/bash
# 启动命令
function start(){
    echo "start..."
    /usr/local/bin/tinyproxy -c /etc/tinyproxy/tinyproxy.conf
    echo "start successful" $(date "+%Y-%m-%d %H:%M:%S")
    return 0
}
# 停止命令
function stop(){
    echo "stop..."
    ps -ef|grep tinyproxy|grep -v grep|awk '{print "kill -9 "$2}'|sh
    echo "stop successful" $(date "+%Y-%m-%d %H:%M:%S")
    return 0
}
# 状态
function status(){
    ps -ef|grep tinyproxy|grep -v grep
    return 0
}
case $1 in
"status")
    status
    ;;
"start")
    start
    ;;
"stop")
    stop
    ;;
"restart")
    stop && start
    ;;
*)
    echo "请输入: start, stop, restart, status"
    ;;
esac

使用方式

bash service.sh start
bash service.sh stop
bash service.sh status
bash service.sh restart

相关文章
remote: HTTP Basic: Access denied. The provided password or token is incorrect or your account has 2
remote: HTTP Basic: Access denied. The provided password or token is incorrect or your account has 2
4566 0
|
网络安全 数据安全/隐私保护
【已解决】mac端 sourceTree 解决remote: HTTP Basic: Access denied报错
又是在一次使用sourcetree拉取或者提交代码时候,遇到了sourcetree报错; 排查了一会,比如查看了SSH keys是否有问题、是否与sourcetree账户状态有问题等等,最终才发现并解决问题
|
开发工具 数据安全/隐私保护 git
git 报错:remote: HTTP Basic: Access denied
git 报错:remote: HTTP Basic: Access denied
295 0
git 报错:remote: HTTP Basic: Access denied
Tinyproxy支持权限校验Basic HTTP Authentication
Tinyproxy支持权限校验Basic HTTP Authentication
252 0
Tinyproxy支持权限校验Basic HTTP Authentication
Tinyproxy支持权限校验Basic HTTP Authentication
271 0
|
Web App开发 前端开发 Android开发
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html><head><meta http-equiv="Cont
使用MAT分析内存泄露 对于大型服务端应用程序来说,有些内存泄露问题很难在测试阶段发现,此时就需要分析JVM Heap Dump文件来找出问题。
813 0
|
Web App开发 前端开发
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html><head><meta http-equiv="Cont
zookeeper watch的定义如下:watch事件是一次性触发器,当watch监视的数据发生变化时,通知设置了该watch的client,即watcher。
964 0
|
Web App开发 监控 前端开发
|
Web App开发 监控 前端开发
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html><head><meta http-equiv="Cont
已发现2个内存错误,应用名称(kernel:),日志内容(hangzhou-jishuan-DDS0248 kernel: sbridge: HANDLING MCE MEMORY ERROR hangzhou-jis...
877 0
|
Web App开发 监控 前端开发
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html><head><meta http-equiv="Cont
一,事务的4个基本特征  Atomic(原子性): 事务中包含的操作被看做一个逻辑单元,这个逻辑单元中的操作要 么全部成功,要么全部失败。
904 0