LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices

Reply
 
LinkBack Search this Thread
Old 07-04-2003, 11:02 AM   #1
dai
Member
 
Registered: May 2002
Location: Wales
Distribution: Slack 8.1, Gentoo 1.3a, Red Hat 7.3, Red Hat 7.2, Manrake 8.2
Posts: 328

Rep: Reputation: 30
Apache Jail with SSL, PHP and MySQL


Right Ive installed APache in /usr/local/Apache2. (making upgrades relatively easy)

Ive created a jail in /var/webroot

Created /var/webroot/usr/local/

installed and configured copy of Apache 2 to run from here.

I still need to copy all required system files etc.

but I have two questions

1. the Jailed APache should use exactly the same httpd.conf as the non-jailed I assume. Is this correct??? If so it would mean copying /etc/ssl into the jail environment, wouldnt it???

2. As I have MySQL installed on same machine (for testing purposes) will I only need to copy the mysql.sock to jailed environment and ammend non-jailed MySQL my.cnf line: socket =/wherever/mysql.sock to socket =/var/webroot/mysql.sock.

Assuming mysql.sock is installed to /var/webroot/

chhers

Last edited by dai; 07-04-2003 at 11:21 AM.
 
Old 07-04-2003, 02:13 PM   #2
dai
Member
 
Registered: May 2002
Location: Wales
Distribution: Slack 8.1, Gentoo 1.3a, Red Hat 7.3, Red Hat 7.2, Manrake 8.2
Posts: 328

Original Poster
Rep: Reputation: 30
Ive managed to jail APache and PHP, ssl and got all require libs in the jail.

However whenever I try to start Apache I get an error stating :

httpd: bad user name webuser

I have placed the webuser in the password and shadow files.

And all dependancies are met

Anybody got any idea what the problem is????

Last edited by dai; 07-04-2003 at 03:56 PM.
 
Old 07-04-2003, 06:13 PM   #3
dai
Member
 
Registered: May 2002
Location: Wales
Distribution: Slack 8.1, Gentoo 1.3a, Red Hat 7.3, Red Hat 7.2, Manrake 8.2
Posts: 328

Original Poster
Rep: Reputation: 30
solved httpd: bad user name by copying whole of /etc/ into the chroot.

now Im going thru it one file at a time removing what I dont need and seeing which files stop Apache working then. Once I resolve this I will post results for others.

one other issue however, Ive tried setting the my.cnf file in normal /etc/ to find the mysql.sock in the /tmp/ directory of the chroot env. Ive changed both the server and local system in my.cnf as follows.

==================================================
# The following options will be passed to all MySQL clients
[client]
#password =*******************
port = 3306
[B]socket = /apachejail/tmp/mysql.sock[B]

# Here follows entries for some specific programs

# The MySQL server
[mysqld]
user=mysql
port = 3306
[B]socket = /apachejail/tmp/mysql.sock[B]
skip-locking
set-variable = key_buffer=16M
set-variable = max_allowed_packet=1M
set-variable = table_cache=64
set-variable = sort_buffer=512K
set-variable = net_buffer_length=8K
set-variable = myisam_sort_buffer_size=8M
log-bin
server-id = 1
default-table-type = innodb
# Point the following paths to different dedicated disks
#tmpdir = /tmp/
#log-update = /path-to-dedicated-directory/hostname
==================================================

Now when I run the MySQL daemon (not in chroot environment it gives following error

ERROR 2002: Can't connect to local MySQL server through socket '/apachejail/tmp/mysql.sock' (2)


anybody know how to solve this????

Last edited by dai; 07-04-2003 at 06:31 PM.
 
Old 07-05-2003, 06:35 AM   #4
dai
Member
 
Registered: May 2002
Location: Wales
Distribution: Slack 8.1, Gentoo 1.3a, Red Hat 7.3, Red Hat 7.2, Manrake 8.2
Posts: 328

Original Poster
Rep: Reputation: 30
Right Ive managed to resolve all conflicts (seemingly).

So Ive got Apache SSL and php jailed.

And ive managed to get the mysql.sock to use /apachejail/tmp as its tmp directory so the jail environment can see it.

Tested SSL>>>>>Works
Tested Simple php Scripts>>>>>>>Works

Need to test whether php can connect to the database from the chroot environment.

Could I usie if config Alias to put another Ip address on the interface so that for example 192.168.1.1 is used by Apache and 192.168.1.2 is used by mysql, would this be more secure?????

Also only user registered in the jail (in/etc/passwd and etc/shadow) is apacheusr, which is a member of apachegrp and has no access to any thing, it only owns the Apache child processes, does this mean that they shouldnt be able to break out of the jail.

The only thing Ive copied into the jail on mass is /lib. Ive removed everything from /etc, there is no/bin or/sbin. does /lib normally contain anything that could be used to break out of the jail????

Last edited by dai; 07-05-2003 at 06:39 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache-ssl not correctly parsing php files jme Linux - Software 2 05-03-2005 12:04 PM
Apache + SSL + PHP + Mysql rjbandura Linux - Software 5 07-01-2004 12:31 PM
Problem with apache SSL and PHP Donboy Linux - Software 3 10-30-2003 12:08 PM
Newbie Linux/Apache/SSL/MySQL/PHP Instalation Dilema rojow Linux - Software 12 10-24-2003 04:48 AM
RH9 Apache/SSL/PHP/MySQL RPM vs tar.gz Ani Linux - Newbie 5 04-26-2003 10:43 AM


All times are GMT -5. The time now is 05:15 AM.

Main Menu
 
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration