Entries Tagged as ''

帮人招系统管理员

Unix/Linux/BSD System Administrator

Job description

§           Unix/Linux server farm setup and maintenance.

§           Database systems setup/maintain

§           Security control of the server farm and company internal network.

§           Network setup of the Unix/Linux server farm.

§           Performance Management and tuning

§           Network Performance management

Requirement

§           Degree in Computer Science or related discipline.

§           Minimum 3 years working experience in Unix/Linux system administration.

§           Minimum 3 years working experience in database administration.

§           Strong knowledge in System/Network security.

§           Hardworking and proactive.

Excellent team player.

尝试着做点服务性的东西。http://services.techtips.cn/

目前只有提供3个方面的东西

ip locate —— ip定位的东东

email icon generate —— 生成email地址的图片表现形式

proxy —— 搜的一些代理列表

但现在也就是proxy稍稍成点样子

nsca从2.5升级到2.6失败

NSCA(Nagios Service Check Acceptor)

原来跑的版本是2.5

昨天尝试这升级到2.6

结果发现服务器端nsca升到2.6后

客户端无论是用新的2.6的send_nsca还是用老的2.5版本的send_nsca

都无法向服务器端发数据

具体表现形式就是

send_nsca -H $nscaip -c send_nsca.cfg

后再输入

hostname    servicesdesc    0    sssdfsfsdfssd

再然后敲Ctrl+d

没有反应

最后timeout掉

还说hostname……没有这个命令什么的

最后只有roll back回去用2.5的nsca

用perl程序监测应用的log发现的怪问题

前几天做一个perl程序

用来监控一个应用生成的log文件

当log里报什么什么的时候

把报的有用的东西处理一下

发到合适的地方



实现方法是用tail -f这个log文件

然后再用管道符"|"传给这个perl程序

结果发现这样可以

但是如果我tail -f这个log文件后

不用管道"|"直接传给perl程序

而是先用grep处理一下

然后再用管道符"|"传给perl程序

这样好像就有问题

perl程序好像根本就接收不到数据



于是我做了下测试

我写了这样一个perl程序:


#!/usr/bin/perl



while(<STDIN>) {

        print "perl:$_";
}



然后tail -f a.log | ./a.pl

这样可以输出所有信息

每行前都加有"perl:"字样

但是当我tail -f a.log | grep xxxx | ./a.pl

这样的时候

系统没有输出

但如果去掉a.pl

tail -f a.log | grep xxxx

这样也是会有很多输出的

为什么会这样呢

一个有意思的“黑客自测站点”

做系统管理员的

做好系统安全是很重要的工作

然知己知彼、百战不殆

因而了解一些黑客的基本知识是非常必要的

下面这个站点好像是专门做这个的

Hack This Site!

这个站点好像n久以前就有了的

居然还没有被封

真是不可思议

注册个帐号进去后

里面有n关(n>1)

必须得一关一关的过

挺有意思的

特别是前面几关都还比较简单

仅需要些小聪明就能搞定

但越到后面越难

要求的基础知识越扎实

哈哈不是基本功扎实的人

自然未能通关

(这是n年前对这个站点的印象:),现在不知道怎么样了)

FC(Fedora core)3下自带的squid的问题

FC3(Fedora Core 3)下自带的Squid真他X的自作聪明

把我可害惨了

原来配了2台squid

策略是不做缓存

在squid.conf中指定了cache_dir null /dev/null

但发现在使用过程中从squid出来的和从real server出来的东西的确不一样!

查来查去

最终发现原来问题在squid的启动脚本/etc/rc.d/init.d/squid

这里他如果发现你没有缓存目录的话

就给你缺省指定一个

!!

他简简单单的自作聪明

却害得我折腾了近一个下午

7点半才从公司下班

55555555555555555555555555

FreeBSD下直接从网络安装ports软件

FreeBSD下只需要设定一个环境变量PACKAGEROOT

就能用命令pkg_add -r 直接从网络下载、安装ports里的软件

比如: setenv PACKAGEROOT ftp://ftp.freebsd.org/

或者

export PACKAGEROOT=ftp://ftp.freebsd.org/

这样的话就可以用命令 pkg_add -r lynx来装ports里的软件了(这里是lynx)

再或者自己做台server

ftp://ftp.freebsd.org/pub/FreeBSD/ 下的ports、packages目录mirror下来

就可以把PACKAGEROOT指向自己的机器

这样安装速度会快很多

我在公司就是这么做的

lighttpd的access log

这两天,产品那边有个需求

牵涉到lighttpd的access log

(需要在access log里加上refer信息,同时还有些特定的url不要记到access log里)

于是哈哈就翻了翻lighttpd的文档(关于access log的)

顺便贴到这里:

 

Accesslog

Module: mod_accesslog

Author: Jan Kneschke
Date: 2004-11-03
Revision: 1.2

Abstract

The accesslog module …

Description

CLF like by default, flexible like apache

Options

accesslog.use-syslog

send the accesslog to syslog

Default: disabled

accesslog.filename

name of the file where the accesslog should be written too if syslog is not used.

if the name starts with a ‘|’ the rest of the name is taken as the name of a process which will be spawn and will get the output

e.g.:

accesslog.filename = "/var/log/lighttpd.log" $HTTP["host"] == "mail.example.org" { accesslog.filename = "|/usr/bin/cronolog" }

Default: disabled

accesslog.format

the format of the logfile

Option Description
%% a percent sign
%h name or address of remote-host
%l ident name (not supported)
%u authenticated user
%t timestamp for the request-start
%r request-line
%s status code
%b bytes sent for the body
%i HTTP-header field
%a remote address
%A local address
%B same as %b
%C cookie field (not supported)
%D time used in ms (not supported)
%e environment (not supported)
%f phyiscal filename
%H request protocol (HTTP/1.0, …)
%m request method (GET, POST, …)
%n (not supported)
%o response header
%p server port
%P (not supported)
%q query string
%T time used in seconds
%U request URL
%v server-name
%V (not supported)
%X connection status
%I bytes incomming
%O bytes outgoing

If %s is written %>s or %<s the < and the > are ignored. They are support for compat with apache.

%i and %o expect the name of the field which should be written in curly brackets.

e.g.:

accesslog.format = "%h %l %u %t \"%r\" %b %>s \"%{User-Agent}i\" \"%{Referer}i\""

Default: CLF compatible output

Response Header

The accesslog module provides a special way to log content from the application in a accesslog file. It can be used to log the session id into a logfile.

If you want to log it into the accesslog just specify the field-name within a %{…}o like

accesslog.format = "%h %l %u %t \"%r\" %b %>s \"%{User-Agent}i\" \"%{Referer}i\" \"%{X-LIGHTTPD-SID}o\""

The prefix X-LIGHTTPD- is special as every response header starting with this prefix is assumed to be special for lighttpd and won’t be sent out to the client.

An example the use this functionality is provided below:

<?php session_start(); header("X-LIGHTTPD-SID: ".session_id()); ?>  

最后我加的配置文件是这么几句: $HTTP["url"] !~ "/(xxxxxx.ini|xxxxx.php)$" {

        accesslog.format = "%h %l %u %t \"%r\" %b %>s \"%{Referer}i\""

        accesslog.filename          = "/www/logs/access_log"

}

 

意思是以xxxxxx.ini或xxxxx.php结尾的访问,不记log 其他都记到/www/logs/access_log里(其中有refer信息)

 
 
 

lighttpd的新洞洞

lighttpd是一小巧但功能并不缺少的开源的web server软件

最近出了一个洞洞

涉及到所有1.4.8及以下的跑在大小写不敏感文件系统下的系统

测试可以这样

wget http://www.example.com/index.php

如果这个将得到正常页面的话

那么

wget http://www.example.com/index.PHP

就将得到index.php的source code

解决方法:

1,升级lighttpd到1.4.9及以上(目前最新的是1.4.11,因为1.4.9也有洞洞了:)

2,添加static-file.exclude-extensions的所有大小写组合到static-file.exclude-extensions里

如这样:

static-file.exclude-extensions =
( ".php", ".Php", ".pHp",
".phP", ".PhP", ".pHP",
".PHp", ".PHP", ".PhP" )

Linux下怎样限制只有特定的用户才能su成root

在FreeBSD下

缺省只有wheel组的成员才能够su成root

在linux下

利用pam.d

也可以实现freebsd下的功能



vi /etc/pam.d/su



看着几句:



# Uncomment the following line to implicitly trust users in the "wheel" group.

#auth       sufficient   /lib/security/$ISA/pam_wheel.so trust use_uid

# Uncomment the following line to require a user to be in the "wheel" group.

#auth       required     /lib/security/$ISA/pam_wheel.so use_uid



这很好理解

把auth开头的2句的注释去掉就行了