官方论坛产品帮助刷图视频问题反馈

Debian安装suPHP

发表于 秦海传媒

使用APT安装suphp,结果不能使用suPHP_UserGroup

apt-get install libapache2-mod-suphp

错误如下:

Invalid command 'suPHP_UserGroup', perhaps misspelled or defined by a module not included in the server configuration

原因是apt的软件包不支持suPHP_UserGroup,所以需要从源码安装suphp。搜索了一下午就没一个正确的结果,终于在一篇英文资料上找到了。原文在文末,这里简要的说下如何安装。

原文地址:http://kb.acenet.us/LAMP_Server_Installation_Guide_on_Debian_6_(Squeeze)
英文内容如下:
If you have properly pointed the DNS for your domain, you should now be able to visit your website in a browser and have your content served from your new Debian LAMP server.
Install suPHP

After getting your site up and running, we generally advise that suPHP be enabled for additional security.
suPHP is a tool for executing PHP scripts with the permissions of their owners. It consists of an Apache module (mod_suphp) and a setuid root binary (suphp) that is called by the Apache module to change the uid of the process executing the PHP interpreter. suPHP helps increase the security of your server. With scripts run as the owner, abusive processes can more easily be tracked back to a given user. Stricter script permissions are enforced since scripts are no longer run as the apache user.
We’ll now show you how to install suPHP on your Debian 6 server with the package manually compiled from source. suPHP has three different modes of operation which must be specified at compile time:

owner: Run scripts with owner UID/GID
force: Run scripts with UID/GID specified in Apache configuration
paranoid: Run scripts with owner UID/GID but also check if they match the UID/GID specified in the Apache configuration

The suPHP documentation states:
"The default is "paranoid" mode. You should *NEVER* use "force" mode as it is very dangerous.
While "owner" mode is not as dangerous as "force" mode its use is disadvised and
"paranoid" mode should be preferred."

In this guide we manually compile suPHP, but there is a pre-built package available for apt-get. This package is libapache2-mod-suphp.
Although suPHP states that the default mode is “paranoid”, the libapache2-mod-suphp is installed in “owner” mode by default. When suPHP is installed in “owner” mode, the directive suPHP_UserGroup is not recognized which is required for “force” or “paranoid” mode. When attempting to use the suPHP_UserGroup directive with suPHP in “owner” mode, you will encounter this error while restarting apache2:

Invalid command 'suPHP_UserGroup', perhaps misspelled or defined by a module not included in the server configuration

For this reason, we opt to install suPHP directly from source rather than use the pre-compile Debian package.
Install suPHP Prerequisites

apt-get install apache2-prefork-dev make gcc g++ php5-cgi wget

Disable PHP5
We’re changing the interpretter that handles PHP scripts. We’ll need to disable PHP5.

a2dismod php5

Installation
Download suPHP
Get the suPHP source. The current version is 0.7.1.

cd /
wget http://suphp.org/download/suphp-0.7.1.tar.gz
tar -zxf suphp-0.7.1.tar.gz
cd suphp-0.7.1

Compile suPHP
This will configure suPHP to use /etc as the configuration directory and set the mode to “paranoid”.

./configure --prefix=/usr --sysconfdir=/etc --with-apache-user=www-data --with-setid-mode=paranoid --with-apxs=/usr/bin/apxs2
make
make install

Copy the suphp.conf file
The suPHP package comes with an example suphp.conf file. We’re going to copy this to /etc.

cp /suphp-0.7.1/doc/suphp.conf-example /etc/suphp.conf

Clean up our installation files

rm -rf /suphp-0.7.1
rm -rf /suphp-0.7.1.tar.gz

Configuring suphp.conf
Let’s modify /etc/suphp.conf for our server environment. Open the config file in your favorite editor. Throughout the course of this guide, we’ll use nano.

nano /etc/suphp.conf

Change the line:
webserver_user=wwwrun
to:
webserver_user=www-data
Change the line:

x-httpd-php="php:/usr/bin/php"

to:

application/x-httpd-suphp="php:/usr/bin/php-cgi"

Loading suPHP in apache2
suphp.load
Create a suphp.load file for apache2

nano /etc/apache2/mods-available/suphp.load

Place this line in the file and save:
LoadModule suphp_module /usr/lib/apache2/modules/mod_suphp.so
apache2 suPHP config file
Create an apache2 conf file for suPHP:

nano /etc/apache2/mods-available/suphp.conf

Place these lines in the file and save.


 
  AddType application/x-httpd-suphp .php .php3 .php4 .php5 .phtml
  suPHP_AddHandler application/x-httpd-suphp
 
  
    suPHP_Engine on
  
 
# By default, disable suPHP for debian packaged web applications as files
# are owned by root and cannot be executed by suPHP because of min_uid.   
 
  
    suPHP_Engine off   
  
 
# 
# Use a specific php config file (a dir which contains a php.ini file)
#       suPHP_ConfigPath /etc/php4/cgi/suphp/
#
# Tells mod_suphp NOT to handle requests with the type .
#       suPHP_RemoveHandler 

Enable suPHP in apache2

a2enmod suphp

We now need to edit our site’s VirtualHost entry to include the suPHP_UserGroup directive. Continuing from our previous guide, our site is called mywebsite.example.com. Our username is ‘mywebsite’. We’re going to edit the appropriate apache2 Virtual Host file:

nano /etc/apache2/sites-available/mywebsite.example.com

Within this file, before the closing tag at the bottom, add these lines:


  suPHP_UserGroup mywebsite mywebsite

Restart Apache

service apache2 restart

At this point, suPHP is enabled and active. Let’s create a test php file in our directory to ensure it’s working properly. Again, we’re going to use the document root as described in our LAMP setup tutorial.
Testing suPHP

Create the PHP file for testing

nano /home/mywebsite/public_html/index.php

Enter this line and save:

< ?php echo 'whoim = '.exec('/usr/bin/whoami');?>

chown the file properly. We’re using the username ‘mywebsite’ in this example.
chown mywebsite.mywebsite /home/mywebsite/public_html/index.php
You should now be able to navigate to this file in a browser and see the output. In our case, we visit mywebsite.example.com and can see:

whoim = mywebsite
This shows us that the PHP script is running as the user ‘mywebsite’ instead of the Apache user ‘www-data’.
suPHP is now installed and ready for use.

VPS.net的用户密码可以这样被泄漏

发表于 秦海传媒

Vps.net是一家世界知名的云计算提供商,博主1日的时候购买了1枚。结果遇到了奇葩事件2个。
奇葩事件一:上行无限,下行512K——媲美我国的ADSL宽带。我用了一天时间传进去2.5G数据。
奇葩事件二:抓包抓网段。博主想抓包看下为什么这么卡。结果发现包跑的N快。仔细一看竟然都不是我的数据流。 继续阅读

原来不是所有的福利主机都像秦海传媒一样的

发表于 秦海传媒

无语了,今天才知道免费还可以这么做的。我在某主机商初注册了一个免费主机,同时还在他那购买一个VPS。 VPS预定1日可以开通。

31日晚上QQ问他能用不,他告诉我已经年付,至少免费一年。 我就在1日提前把数据从矿总搬到日本了。上午数据搬完了,中午我联系他开通VPS,他告诉我准备中。结果下午就给我把主机改成不属实状态了。

我注册地址 电话 姓名 连邮编都是真实竟然给我一个不属实,哪有这么搞的!包括开通的域名和上传的站点域名都是一个!

晚上联系到了技术,技术回复说占资源过重。把服务器拖垮了,服务器上的图是没有了。但是站原来呆的矿总VPS倒是有。CPU放一个月,IO 带宽放24小时的。
IO_1day

net_1day

cpu_30

WDCP安全优化,只允许指定IP段访问面板

发表于

代码如下:

iptables -I INPUT -p tcp --dport 8080 -j DROP 
iptables -I INPUT -s 111.227.231.0/24 -p tcp --dport 8080 -j ACCEPT #允许本地IP访问
iptables -I INPUT -s 69.85.93.0/24 -p tcp --dport 8080 -j ACCEPT #允许我的服务器访问
iptables -I INPUT -s 209.141.35.207 -p tcp --dport 8080 -j ACCEPT #允许我的VPS访问(VPS上有SSH代理)
service iptables save
service iptables restart

这样本地IP更换的话也可以通过Proxy swich切换到SSH代理上访问。

=====以下下转载=====
以下是端口,先全部封再开某些的IP
iptables -I INPUT -p tcp –dport 9889 -j DROP
iptables -I INPUT -s 192.168.1.0/24 -p tcp –dport 9889 -j ACCEPT
如果用了NAT转发记得配合以下才能生效
iptables -I FORWARD -p tcp –dport 80 -j DROP
iptables -I FORWARD -s 192.168.1.0/24 -p tcp –dport 80 -j ACCEPT

常用的IPTABLES规则如下:
只能收发邮件,别的都关闭
iptables -I Filter -m mac –mac-source 00:0F:EA:25:51:37 -j DROP
iptables -I Filter -m mac –mac-source 00:0F:EA:25:51:37 -p udp –dport 53 -j ACCEPT
iptables -I Filter -m mac –mac-source 00:0F:EA:25:51:37 -p tcp –dport 25 -j ACCEPT
iptables -I Filter -m mac –mac-source 00:0F:EA:25:51:37 -p tcp –dport 110 -j ACCEPT

IPSEC NAT 策略
iptables -I PFWanPriv -d 192.168.100.2 -j ACCEPT
iptables -t nat -A PREROUTING -p tcp –dport 80 -d $INTERNET_ADDR -j DNAT –to-destination 192.168.100.2:80
iptables -t nat -A PREROUTING -p tcp –dport 1723 -d $INTERNET_ADDR -j DNAT –to-destination 192.168.100.2:1723
iptables -t nat -A PREROUTING -p udp –dport 1723 -d $INTERNET_ADDR -j DNAT –to-destination 192.168.100.2:1723
iptables -t nat -A PREROUTING -p udp –dport 500 -d $INTERNET_ADDR -j DNAT –to-destination 192.168.100.2:500
iptables -t nat -A PREROUTING -p udp –dport 4500 -d $INTERNET_ADDR -j DNAT –to-destination 192.168.100.2:4500

FTP服务器的NAT
iptables -I PFWanPriv -p tcp –dport 21 -d 192.168.100.200 -j ACCEPT
iptables -t nat -A PREROUTING -p tcp –dport 21 -d $INTERNET_ADDR -j DNAT –to-destination 192.168.100.200:21

只允许访问指定网址
iptables -A Filter -p udp –dport 53 -j ACCEPT
iptables -A Filter -p tcp –dport 53 -j ACCEPT
iptables -A Filter -d www.3322.org -j ACCEPT
iptables -A Filter -d img.cn99.com -j ACCEPT
iptables -A Filter -j DROP

开放一个IP的一些端口,其它都封闭
iptables -A Filter -p tcp –dport 80 -s 192.168.100.200 -d www.pconline.com.cn -j ACCEPT
iptables -A Filter -p tcp –dport 25 -s 192.168.100.200 -j ACCEPT
iptables -A Filter -p tcp –dport 109 -s 192.168.100.200 -j ACCEPT
iptables -A Filter -p tcp –dport 110 -s 192.168.100.200 -j ACCEPT
iptables -A Filter -p tcp –dport 53 -j ACCEPT
iptables -A Filter -p udp –dport 53 -j ACCEPT
iptables -A Filter -j DROP

多个端口
iptables -A Filter -p tcp -m multiport –destination-port 22,53,80,110 -s 192.168.20.3 -j REJECT

连续端口
iptables -A Filter -p tcp -m multiport –source-port 22,53,80,110 -s 192.168.20.3 -j REJECT iptables -A Filter -p tcp –source-port 2:80 -s 192.168.20.3 -j REJECT

指定时间上网
iptables -A Filter -s 10.10.10.253 -m time –timestart 6:00 –timestop 11:00 –days Mon,Tue,Wed,Thu,Fri,Sat,Sun -j DROP
iptables -A Filter -m time –timestart 12:00 –timestop 13:00 –days Mon,Tue,Wed,Thu,Fri,Sat,Sun -j ACCEPT
iptables -A Filter -m time –timestart 17:30 –timestop 8:30 –days Mon,Tue,Wed,Thu,Fri,Sat,Sun -j ACCEPT
禁止多个端口服务
iptables -A Filter -m multiport -p tcp –dport 21,23,80 -j ACCEPT

将WAN 口NAT到PC
iptables -t nat -A PREROUTING -i $INTERNET_IF -d $INTERNET_ADDR -j DNAT –to-destination 192.168.0.1

将WAN口8000端口NAT到192。168。100。200的80端口
iptables -t nat -A PREROUTING -p tcp –dport 8000 -d $INTERNET_ADDR -j DNAT –to-destination 192.168.100.200:80

MAIL服务器要转的端口
iptables -t nat -A PREROUTING -p tcp –dport 110 -d $INTERNET_ADDR -j DNAT –to-destination 192.168.100.200:110
iptables -t nat -A PREROUTING -p tcp –dport 25 -d $INTERNET_ADDR -j DNAT –to-destination 192.168.100.200:25

只允许PING 202。96。134。133,别的服务都禁止
iptables -A Filter -p icmp -s 192.168.100.200 -d 202.96.134.133 -j ACCEPT
iptables -A Filter -j DROP
禁用BT配置
iptables –A Filter –p tcp –dport 6000:20000 –j DROP
禁用QQ防火墙配置
iptables -A Filter -p udp –dport ! 53 -j DROP
iptables -A Filter -d 218.17.209.0/24 -j DROP
iptables -A Filter -d 218.18.95.0/24 -j DROP
iptables -A Filter -d 219.133.40.177 -j DROP
基于MAC,只能收发邮件,其它都拒绝
iptables -I Filter -m mac –mac-source 00:0A:EB:97:79:A1 -j DROP
iptables -I Filter -m mac –mac-source 00:0A:EB:97:79:A1 -p tcp –dport 25 -j ACCEPT
iptables -I Filter -m mac –mac-source 00:0A:EB:97:79:A1 -p tcp –dport 110 -j ACCEPT
禁用MSN配置
iptables -A Filter -p udp –dport 9 -j DROP
iptables -A Filter -p tcp –dport 1863 -j DROP
iptables -A Filter -p tcp –dport 80 -d 207.68.178.238 -j DROP
iptables -A Filter -p tcp –dport 80 -d 207.46.110.0/24 -j DROP
只允许PING 202。96。134。133 其它公网IP都不许PING
iptables -A Filter -p icmp -s 192.168.100.200 -d 202.96.134.133 -j ACCEPT
iptables -A Filter -p icmp -j DROP
禁止某个MAC地址访问internet:
iptables -I Filter -m mac –mac-source 00:20:18:8F:72:F8 -j DROP
禁止某个IP地址的PING:
iptables –A Filter –p icmp –s 192.168.0.1 –j DROP
禁止某个IP地址服务:
iptables –A Filter -p tcp -s 192.168.0.1 –dport 80 -j DROP
iptables –A Filter -p udp -s 192.168.0.1 –dport 53 -j DROP
只允许某些服务,其他都拒绝(2条规则)
iptables -A Filter -p tcp -s 192.168.0.1 –dport 1000 -j ACCEPT
iptables -A Filter -j DROP
禁止某个IP地址的某个端口服务
iptables -A Filter -p tcp -s 10.10.10.253 –dport 80 -j ACCEPT
iptables -A Filter -p tcp -s 10.10.10.253 –dport 80 -j DROP
禁止某个MAC地址的某个端口服务
iptables -I Filter -p tcp -m mac –mac-source 00:20:18:8F:72:F8 –dport 80 -j DROP
禁止某个MAC地址访问internet:
iptables -I Filter -m mac –mac-source 00:11:22:33:44:55 -j DROP
禁止某个IP地址的PING:
iptables –A Filter –p icmp –s 192.168.0.1 –j DROP
payday loans

  • 发表在 闲言碎语 | WDCP安全优化,只允许指定IP段访问面板已关闭评论

Godaddy Economy主机绑定域名并建立多个站点

发表于 秦海传媒

Economy主机现在仅需24.06美元一年,还赠送一个域名。100G空间不限流量非常划算,无论备份还是建站都值得选择。

但是该主机默认只能建立一个站点,和鳄鱼的入门主机一样。很多人使用.htaccess来绑定多域名,不过由于有一定的缺陷造成部分网站出错。 所以这里介绍一种更好的绑定方式。
首先为主域名添加子域名,子域名可以指定目录。然后添加新域名进来。
在根目录修改.htaccess如下:


# BEGIN New Domain

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^cdnews.info$
RewriteRule ^(.*)$ http://cdnew.46book.com/$1 [P]

RewriteCond %{HTTP_HOST} ^www.cdnews.info$
RewriteRule ^(.*)$ http://cdnew.46book.com/$1 [P]

# END New Domain

在域名目录修改.htaccess如下:

# BEGIN WordPress


RewriteEngine On
RewriteBase /
#禁止域名访问
RewriteCond %{HTTP_HOST} !^cdnew.46book.com$ [NC]   这里换成你的域名 
RewriteRule ^(.*)$ http://www.cdnews.info/$1 [L,R=301]
#禁止域名访问

RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]


# END WordPress

Google ADs

除非另有声明,本站文章遵循知识共享署名-非商业性使用 2.5 中国大陆许可协议。 Copyright © 2008-2012 99288.NET.CN.