海运的博客

Puppet错误Run of Puppet configuration client already in progress; skipping解决

发布时间:August 31, 2012 // 分类:Puppet // No Comments

Puppet在同步时遇到以下错误:

notice: Run of Puppet configuration client already in progress; skipping

删除puppetdlock重试解决:

rm /var/lib/puppet/state/puppetdlock

Centos服务器安全配置SSH使用Google Authenticator二次验证

发布时间:August 30, 2012 // 分类:网络安全 // 2 Comments

CentOS安装所需组件:

yum -y install mercurial pam-devel

安装Google Authenticator:

#https://www.haiyun.me
wget --no-check-certificate https://google-authenticator.googlecode.com/files/libpam-google-authenticator-1.0-source.tar.bz2
tar jxvf libpam-google-authenticator-1.0-source.tar.bz2 
cd libpam-google-authenticator-1.0
make
make install

SSH登录时调用google-authenticator模块,编辑:

/etc/pam.d/sshd

第一行添加:

auth       required     pam_google_authenticator.so

修改SSH配置文件:

vim /etc/ssh/sshd_config

添加或修改以下内容:

ChallengeResponseAuthentication yes
UsePAM yes

重启SSH:

/etc/init.d/sshd restart

生成google-authenticator配置,运行:

google-authenticator 
Do you want authentication tokens to be time-based (y/n) y
https://www.google.com/chart?chs=200x200&chld=M|0&cht=qr&chl=otpauth://totp/root@node1.www.haiyun.me%3Fsecret%3DABEXG5K6CVB56BXY
#此网址为生成的二维码,客户端扫描
Your new secret key is: www.haiyun.me
Your verification code is 582849
Your emergency scratch codes are:
  30776626
  14200155
  80795568
  23936997
  21919909
#上面几行数字为应急码
Do you want me to update your "/root/.google_authenticator" file (y/n) y
#更新配置文件
Do you want to disallow multiple uses of the same authentication
token? This restricts you to one login about every 30s, but it increases
your chances to notice or even prevent man-in-the-middle attacks (y/n) y
#禁止一个口令多用
By default, tokens are good for 30 seconds and in order to compensate for
possible time-skew between the client and the server, we allow an extra
token before and after the current time. If you experience problems with poor
time synchronization, you can increase the window from its default
size of 1:30min to about 4min. Do you want to do so (y/n) n
#客户端与服务器时间误差
If the computer that you are logging into isn't hardened against brute-force
login attempts, you can enable rate-limiting for the authentication module.
By default, this limits attackers to no more than 3 login attempts every 30s.
Do you want to enable rate-limiting (y/n) y
#次数限制

Android安装google-authenticator客户端,扫描添加上方网址的二维码,以后在登录服务器时输入账号密码的同时还需输入google-authenticator即时生成的验证码才能登录。

ssh www.haiyun.me
Verification code: 
Password: 

WinSCP普通用户登录sftp切换到root权限

发布时间:August 28, 2012 // 分类:常用软件 // No Comments

一般服务器为安全禁止ssh下root账号登录,此时使用sftp登录管理服务器只能使用普通账号登录,给管理带来诸多不便,可以设置为特定普通SSH用户添加sudo权限,登录到sftp时可sudo切换到root权限下。
查看sftp-server执行文件目录:

cat /etc/ssh/sshd_config|grep sftp
Subsystem    sftp    /usr/libexec/openssh/sftp-server

编辑/etc/sudoers为特定用户添加执行sftp sudo权限:

#https://www.haiyun.me
user ALL=NOPASSWD:  /usr/libexec/openssh/sftp-server

后续如果登录失败日记显示:

sorry, you must have a tty to run sudo ; TTY=unknown

需在/etc/sudoers内注释此行:

#Defaults    requiretty  

sftp客户端设置登录以sudo权限执行sftp,下图以winscp为例:

sudo /usr/libexec/openssh/sftp-server

winscp设置普通用户切换到root.png
此时用winscp登录就是root权限了,对整个系统的文件都拥有生杀大权。。。

Centos软件包管理工具yum和rpm常用命令

发布时间:August 28, 2012 // 分类:Linux基础 // No Comments

CentOS包管理rpm常用命令,查询未安装软件时加参数p:

#https://www.haiyun.me
rpm -qa #列出系统当前安装的软件
rmm -qa pkg #查询系统是否已安装特定软件
rpm -qf /path/file #查询特定文件属于哪个软件
rpm -ql pkg #列出软件所包含的文件
rpm -qi pkg #查询已安装软件的详细信息
rpm -qR pkg #查询已安装软件的依赖关系
rpm -qd pkg #查询已安装软件的文档目录
rpm -ivh pkg #安装软件
rpm -Uvh pkg #更新软件
rpm -e pkg #删除软件

yum常用命令:

yum install pkg #安装软件
yum remove pkg #删除软件
yum check-update #检查更新
yum update #更新
yum clean all #清除所有缓存
yum search pkg #搜索软件
yum deplist pkg #查看依赖关系

PPPOE服务器CHAP连接验证流程

发布时间:August 28, 2012 // 分类:ROS // No Comments

ROS配置PPPOE服务器,连接 PPPOE服务器监听数据包如下:

07:50:52.398419 PPPoE PADI [Service-Name] [Host-Uniq 0x12150000]
07:50:52.398461 PPPoE PADO [Host-Uniq 0x12150000] [Service-Name] [AC-Name "MikroTik"] [Service-Name "pppoe"]
07:50:52.400079 PPPoE PADR [Service-Name] [Host-Uniq 0x12150000]
07:50:52.400120 PPPoE PADS [ses 0x12] [Host-Uniq 0x12150000] [Service-Name]
07:50:52.402604 PPPoE  [ses 0x12] LCP, Conf-Request (0x01), id 1, length 16
07:50:52.402611 PPPoE  [ses 0x12] LCP, Conf-Request (0x01), id 1, length 21
07:50:52.402611 PPPoE  [ses 0x12] LCP, Conf-Ack (0x02), id 1, length 16
07:50:52.403494 PPPoE  [ses 0x12] LCP, Conf-Ack (0x02), id 1, length 21
07:50:52.403502 PPPoE  [ses 0x12] CHAP, Challenge (0x01), id 1, Value 3cca193423b93a6e8b13609aa4209bf1, Name MikroTik
07:50:52.406462 PPPoE  [ses 0x12] LCP, Echo-Request (0x09), id 0, length 10
07:50:52.406467 PPPoE  [ses 0x12] LCP, Echo-Reply (0x0a), id 0, length 10
07:50:52.408030 PPPoE  [ses 0x12] CHAP, Response (0x02), id 1, Value 8fbdbac8f438f0c540fc21f801d0e6fe, Name user
07:50:52.408050 PPPoE  [ses 0x12] CHAP, Success (0x03), id 1, Msg Welcome.

PPPOE连接验证流程如下:

#https://www.haiyun.me
客户端开始连接发送广播包PADI寻找PPPOE服务器
PPPOE服务器接受到PADI广播包后,回复PADO注明主机名、服务类型。
客户端选择PPPOE服务器。
PPPOE服务器收到客户端发送的PADR消息后,给客户端分配会话ID并进行会话确认。
PPPOE服务器主动向客户端主动发起连接,发送一些随机字符串、id和PPPOE服务器的主机名作为连接信息。
客户端根据PPPOE服务器连接信息中字符串、id、主机名、账号密码计算出md5值发送给PPPOE服务器,同时明文发送账号。
PPPOE服务器确认验证信息是否正确,若正确定进行网络配置阶段,错误则断开链路。
分类
最新文章
最近回复
  • 海运: 恩山有很多。
  • swsend: 大佬可以分享一下固件吗,谢谢。
  • Jimmy: 方法一 nghtp3步骤需要改成如下才能编译成功: git clone https://git...
  • 海运: 地址格式和udpxy一样,udpxy和msd_lite能用这个就能用。
  • 1: 怎么用 编译后的程序在家里路由器内任意一台设备上运行就可以吗?比如笔记本电脑 m参数是笔记本的...
  • 孤狼: ups_status_set: seems that UPS [BK650M2-CH] is ...
  • 孤狼: 擦。。。。apcupsd会失联 nut在冲到到100的时候会ONBATT进入关机状态,我想想办...
  • 海运: 网络,找到相应的url编辑重发请求,firefox有此功能,其它未知。
  • knetxp: 用浏览器F12网络拦截或监听后编辑重发请求,修改url中的set为set_super,将POS...
  • Albert: 啊啊啊啊啊啊啊啊啊 我太激动了,终于好了英文区搜索了半天,翻遍了 pve 论坛没找到好方法,博...