Centos7 安装 I2p 远程管理

##安装Java环境
yum install -y java-1.8.0-openjdk.x86_64

##下载i2p
curl  https://files.i2p-projekt.de/2.6.1/i2pinstall_2.6.1.jar -O

##安装i2p
java -jar i2pinstall_2.6.1.jar -console

安装的时候会提示选择目录,推荐使用 /root/i2p/

配置文件在 /root/.i2p 目录。 修改 clients.config 文件

clientApp.0.args=7657 0.0.0.0 ./webapps/

修改 /root/.i2p/router.config 增加密码,注意实际要复杂一点。

consolePassword=123456

在/root/i2p/ 目录启动i2p,如果当前用户是 root ,需要修改 i2prouter 文件,把里面的 ALLOW_ROOT=true 去掉注释。

./i2prouter start

打开http://ip:7657/configupdate 选择『仅下载、验证并重启』。

解决Linux 中/Var/Spool/Postfix/Maildrop目录下堆积大量小文件问题

Linux在执行cron的时候,会默认把运行输出以邮件的发给cron所有者,但是很多时候都没有配置sendmail 和 postfix,于是大量发送失败的邮件就堆积在maildrop 目录里面了,日积月累越来越多。

这些小文件可以直接删除,不过使用 rm -rf /var/spool/postfix/maildrop/ 删除会提示参数过多,使用下面的命令分割参数即可:

find /var/spool/postfix/maildrop/ -type f |xargs rm -rf

另外如果不需要邮件提示,可以把cron的输出指向 /dev/null 2>&1 。

获取配置LET’S ENCRYPT(CERTBOT)的免费HTTPS证书

维基百科介绍

Let’s Encrypt 是一个将于2015年末推出的数字证书认证机构,将通过旨在消除当前手动创建和安装证书的复杂过程的自动化流程,为安全网站提供免费的SSL/TLS证书。

Let’s Encrypt 是由互联网安全研究小组(ISRG,一个公益组织)提供的服务。主要赞助商包括电子前哨基金会,Mozilla基金会,Akamai以及思科。2015年4月9日,ISRG与Linux基金会宣布合作。

用以实现这一新的数字证书认证机构的协议被称为自动证书管理环境(ACME)。[4] GitHub上有这一规范的草案,且提案的一个版本已作为一个Internet草案发布。

Let’s Encrypt 宣称这一过程将十分简单、自动化并且免费。


安装Let’s Encrypt(certbot)

GitHub地址:https://github.com/certbot/certbot

Centos7搭建tor Relay 中继

添加官方源/etc/yum.repos.d/tor.repo

[tor]
name=Tor for Enterprise Linux $releasever - $basearch
baseurl=https://rpm.torproject.org/centos/$releasever/$basearch
enabled=1
gpgcheck=1
gpgkey=https://rpm.torproject.org/centos/public_gpg.key
cost=100

或者使用epel源

yum install epel-release

安装tor

yum install tor

修改配置文件/etc/tor/torrc

ExitPolicy reject #非出口节点
AccountingMax 500 GBytes # 每月分配给 Tor 500G 流量  
AccountingStart month 1 0:00 # 每月1号0点(Locale)清零  
RelayBandwidthRate 20000 KBytes  # Throttle traffic to 20000KB/s 
RelayBandwidthBurst 20000 KBytes # But allow bursts up to 20000KB/s

开机启动

sudo systemctl enable tor

启动

systemctl start tor

使用docker


docker run -d -v /etc/localtime:/etc/localtime --restart always -p 9001:9001 -e "RELAY_BANDWIDTH_RATE=20000 KBytes"  -e "RELAY_BANDWIDTH_BURST=20000 KBytes" --name tor-relay jess/tor-relay -f /etc/tor/torrc.middle

参考文章:https://blog.jessfraz.com/post/running-a-tor-relay-with-docker/

使用proxychains-Ng为Linux编译设置代理

最近我在编译一些程序,但是下载依赖包的时候,会碰到网络问题,使用proxychains-ng就好了,使用教程记录如下:

git clone https://github.com/rofl0r/proxychains-ng
cd proxychains-ng
./configure --prefix=/usr --sysconfdir=/etc
make 
make install
make install-config

配置文件位置 /etc/proxychains.conf 我的配置文件:

strict_chain
remote_dns_subnet 224
tcp_read_time_out 15000
tcp_connect_time_out 8000
[ProxyList]
socks5     127.0.0.1 1080

proxychains-ng支持多种代理模式:

  • dynamic_chain :动态模式,按照代理列表顺序自动选取可用代理

  • strict_chain :严格模式,严格按照代理列表顺序使用代理,所有代理必须可用

  • round_robin_chain :轮询模式,自动跳过不可用代理

  • random_chain :随机模式,随机使用代理 使用方法:

    proxychains4 wget https://www.google.com/
    proxychains4  -q /bin/bash  #本次所有命令有效

    另外可以把proxychains4 -q /bin/bash 加入.bashrc或者.bash_profile中,每次登录自动使用代理。

阿里云centos6 Yum更新内核

1.导入key

rpm --import [https://www.elrepo.org/RPM-GPG-KEY-elrepo.org](https://www.elrepo.org/RPM-GPG-KEY-elrepo.org) #导入key

2.添加仓库

yum install -y [http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm](http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm) //centos 7 执行这个添加源
rpm -Uvh http://www.elrepo.org/elrepo-release-6-8.el6.elrepo.noarch.rpm // centos 6 执行这个添加源

3.安装驱动 https://help.aliyun.com/knowledge_detail/59360.html 4.安装内核

yum --enablerepo=elrepo-kernel install -y kernel-ml //安装当前最新内核,以后升级内核直接运行这句就可
yum --enablerepo=elrepo-kernel install -y kernel-lt //安装当前长期维护内核,以后升级内核直接运行这句就可

5.修改 /etc/grub.conf,将default=1改成default=0 6.reboot 7.uname -r查看内核版本

Centos安装oh My Zsh

安装zsh

yum -y install zsh git

安装 oh my zsh

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

修改配置文件添加插件

nano ~/.zshrc
plugins=(git osx autojump zsh-autosuggestions zsh-syntax-highlighting)

注意:其中 zsh-autosuggestions 和 zsh-syntax-highlighting 是自定义安装的插件,需要用 git 将插件 clone 到指定插件目录下:

# 自动提示插件
git clone git://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions
# 语法高亮插件
git clone git://github.com/zsh-users/zsh-syntax-highlighting $ZSH_CUSTOM/plugins/zsh-syntax-highlighting

更新配置

source ~/.zshrc

IREDMAIL设置默认接收邮箱,解决不存在邮箱地址自动转发

在iRedMail开源版中,缺乏一些高级管理,如邮箱别名这些,但是iRedMail提供了手动修改数据库的方式实现。

邮件列表

sql> USE vmail;
sql> INSERT INTO alias (address, goto, domain, islist) \
VALUES ('[email protected]', \
'[email protected],[email protected],[email protected]', \
'example.com', \
1);

发送给 [email protected] 的邮件就会被转发给 [email protected],[email protected],[email protected],一般方便提供部门或者全公司抄送。

邮箱别名

sql> USE vmail;
sql> INSERT INTO alias (address, goto, domain, islist) \
VALUES ('[email protected]', \
'[email protected]', \
'example.com', \
0);

发送给 [email protected] 的邮件就会被转发给 [email protected]。

默认邮箱

sql> USE vmail;
sql> INSERT INTO alias (address, goto, domain, islist) \
VALUES ('@example.com', \
'[email protected]', \
'example.com', \
0);

默认邮箱一般是当邮箱地址不存在的时候,默认转发邮箱。注意 address 字段有一个 @ ,goto字段必须是一个存在的邮箱。