我认识的一个系统管理员建议我在 chroot jail 中运行 Apache,以提高安全性。
我有以下问题:
他还建议我在单独的 chroot jail 中运行我的数据库(mySQL 和 PostgreSQL)。
这是生产系统中经常做的事情吗
[编辑]
忘了说,服务器运行在 Ubuntu 8.04 LTS 上
我需要设置一些用户来访问我们的服务器。我认为允许他们访问的最安全的方法是设置一个 chroot 监狱让他们登录。
但是我需要他们访问 chroot 环境之外的一些选择目录。显然我不能为此使用符号链接。最好的方法是什么?chroot 环境不能用于此目的吗?
我正在运行 Ubuntu,使用 PHP5-FPM、mysql 和 Nginx
我刚刚用 jailkit 设置了一个 chroot 监狱。现在我需要弄清楚如何设置我的 php 和 mysql 以在监狱中工作。
谷歌搜索并没有给我太多,而且在 jailkit 网站上没有相关文档。(这可能很容易,但我对这个领域还很陌生)
我创建了一个 chroot 监狱,但现在我希望能够在监狱内创建一个链接,该链接链接到监狱之外。这可能吗?
有没有办法在木偶清单中定义硬链接?
似乎文件类型只能定义符号链接,但我需要它是硬链接才能使我的一些 chroot 应用程序工作。例如,我需要硬链接
/etc/hosts -> $chroot/etc/hosts
/etc/resolvf.com -> $chroot/etc/resolv.conf
Run Code Online (Sandbox Code Playgroud)
等等。
存档的最简单方法是什么?
更新:谢谢,我已经结束了以下定义:
define hardlinkdir(source=$name, target) {
exec {
"hardlinkdir-$name":
command => "cp -r --link $target $source",
path => "/usr/bin:/bin",
creates => $source;
}
}
define hardlink(source=$name, target) {
exec {
"hardlink-$name":
command => "ln --force $target $source",
path => "/usr/bin:/bin",
unless => "test $source -ef $target";
}
}
Run Code Online (Sandbox Code Playgroud)
当然,它们并不完美,但它们可以胜任,这是我需要的一切。
感谢您的帮助!
有PHP-FPM和OPCache(从php.net下载并编译)
opcache.enable = 1
opcache.use_cwd = 1
zend_extension=opcache.so
Run Code Online (Sandbox Code Playgroud)
php-fpm 配置文件在 chroot 中运行,即/home/user1/www/index.php-> /www/index.php、/home/user2/www/index.php-> /www/index.php,这index.php两种情况下都会看到。
user1已经安装了WordPress。user2有定制index.php。
user1user2's index.php 在's之前执行index.php。
在这种情况下,当我index.php从文件夹调用时,我会看到来自文件夹user2的编译输出。index.phpuser1
目前的解决方案。我可以为每个用户运行不同的 PHP,否则我必须终止我漂亮的结构/home/user1/www,导致/home/user1/user1www/OPcache 需要查看不同的路径。或者我禁用OPcache,但它会影响性能。
有没有办法保留/home/user1/www、/home/user2/www等并让 OPcache 正常工作?
如果可能的话,有人可以告诉我如何使用 Virtualmin chroot FTP 用户。
我正在尝试在新的 CentOS 6.3 机器上设置 PHP-FPM Chroot jail。我可以让 chroot 正常工作,从某种意义上说,我可以让 php 脚本做出响应并回显出来。但是,每次使用 date 函数时,都会收到一条错误消息,指出时区数据库已损坏。
我所做的只是将 php-fpm conf 中 chroot 指令的值更改为 nginx 中指定的文档根目录。
这是测试脚本:
https://gist.github.com/3199578
这是 nginx 虚拟主机
https://gist.github.com/3199552
这是我转到 localhost 时得到的输出
我正在运行 Ubuntu 12.04.1 LTS(GNU/Linux 3.2.0-30-generic x86_64)服务器,使用 OpenSSH_5.9p1 Debian-5ubuntu1,OpenSSL 1.0.1 2012 年 3 月 14 日。
我想使用 /etc/ssh/sshd_config 中的设置为 sftp 访问配置 chroot,并使用基于密钥的身份验证。
我已经按照这里的教程进行操作:http : //www.thegeekstuff.com/2012/03/chroot-sftp-setup/
该教程帮助我让 sftp 使用密码身份验证。我修改了 /etc/ssh/sshd_config 文件并复制了密钥以尝试使基于密钥的身份验证工作,但到目前为止,没有运气。
我的 /etc/ssh/sshd_config 文件的相关部分:
# Change to no to disable tunnelled clear text passwords
PasswordAuthentication yes
# Of course, I'd like to change this to no once key-based auth is working
# Commenting for chroot use
#Subsystem sftp /usr/lib/openssh/sftp-server
Subsystem sftp internal-sftp
Match Group sftpusers
ChrootDirectory /sftp/%u
ForceCommand internal-sftp
PubkeyAuthentication yes …Run Code Online (Sandbox Code Playgroud) 我可以限制通过 sftp 登录的用户只能查看和更改 var/www/html 文件夹下的文件吗?
我在下面尝试过,但后来我无法通过 sftp 登录 Transmit
# adduser user_www
# passwd user_www
# vi /etc/ssh/sshd_config
// add in file end
Match User user_www
ChrootDirectory /var/www
# service sshd restart
Run Code Online (Sandbox Code Playgroud)
/var/日志/安全
Jul 13 11:29:23 li390-124 sshd[10269]: Accepted password for user_www from 106.65.234.106 port 19962 ssh2
Jul 13 11:29:23 li390-124 sshd[10269]: pam_unix(sshd:session): session opened for user user_www by (uid=0)
Jul 13 11:29:23 li390-124 sshd[10271]: subsystem request for sftp
Jul 13 11:29:23 li390-124 sshd[10271]: error: subsystem: cannot stat /usr/libexec/openssh/sftp-server: No …Run Code Online (Sandbox Code Playgroud)