Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
more apache/php
#1
Been kind of busy this past week, and this week too. Going to continue with my webserver project en wil post and document here so others can use it and I'll post my questions here when I'm stuck on something and can't figure it out. I'm going to try install/configure suphp, mod_ssl, and maybe mod_security. And maybe others but just starting with these.
Reply
#2

mod_ssl is probably the easiest to handle first up - it's basically generating a certificate then configuring a Vhost with the SSL engine enabled. You may get the runaround with different dir locations, but CHECK THE LOGFILES, see what errors they report. That's usually the best way of determining what is going wrong.

 

Just watch out for the other two "interfering" with each other. suPHP will prevent content being served up if they have the wrong permissions or are in locations not whitelisted by the suPHP config file. Also note that suPHP can point to a different php.ini file - using the "phpinfo();" trick to report current configs is always a good bet, as well as checking logfiles - in particular the suPHP one, rather than the apache one.

 

As for mod_security... that was a whole new world of hurt for me, but I got them all working together successfully.

 

Only real advice I can give is: make ONE change at a time, check logs, see the effect. Making too many changes means it's difficult to work out which change "broke" things.

 

Good luck!

Reply
#3

Thanks for the tip with follow it up :) I reinstalled my server with CentOS 6 it's a bit different but got some trouble getting it to work but it's running again now. First time installed it I was able to install apache, php, and mysql. I was able to update root user but wasn't able to update TABLE feedmebits.user table. seemed like the user didn't even exist. I did another reinstall and my server hung up on installation. Contacted my host and they said partition table was corrupt so that might have explained my problem in MySQL. I was now able to update my mysql password. Then I setup my apache configuration and wasn't able to get it to work for two days. I finally deleted all my apache configuration and retypted everything and restarted apache and it works now again. Have Joomla installed and my virtual domains work :) Now I can continue with what I mentioned here in this post :)

 

******************

 

This was the error I got but I'm pretty sure it was because of my corrupt partition cuz I had it the every time after reinstalling the system twice. and after hosting fixed the partition I was able to do it without any problems:

 

 

mysql> USE databasename_db;

Database changed

mysql> UPDATE user SET Password=PASSWORD('password') WHERE user='testuser';

ERROR 1146 (42S02): Table 'databasename_db.user' doesn't exist

mysql>

Reply
#4

I did come across something. I decided to install a virtual version of my server on my local pc so I can try it out first before I actually do it on my dedicated server. I made the virtual machine and installed with no problem I was able install mysql and httpd. I was reset root user mysql password and I was able to make a mysql database and assign/make a user and give that user privilges. As soon as I try and reset the user password I get this same error again:

 

ERROR 1146 (42S02): Table 'feedmebits_db.user' doesn't exist

 

So it can't be because of a corrupt partition because I just installed the system. Been looking to find an answer on google but haven't found anything that could help met out yet. Any ideas?

Reply
#5

Quote:mysql> USE databasename_db;

Database changed

mysql> UPDATE user SET Password=PASSWORD('password') WHERE user='testuser';

ERROR 1146 (42S02): Table 'databasename_db.user' doesn't exist

mysql>
All users are stored in the mysql.users table, ie: the "users" table in the "mysql" database.

 

A safer method is to use the "set password" statement, rather than try to update the mysql.users table directly, i.e.:



Code:
set password for testuser = password('PA55W0RD!');




Reply
#6

Quote:<blockquote data-ipsquote="" class="ipsQuote" data-ipsquote-contentcommentid="15092" data-ipsquote-username="feedmebits" data-cite="feedmebits" data-ipsquote-timestamp="1315549052" data-ipsquote-contentapp="forums" data-ipsquote-contenttype="forums" data-ipsquote-contentid="4150" data-ipsquote-contentclass="forums_Topic"><div>
mysql> USE databasename_db;

Database changed

mysql> UPDATE user SET Password=PASSWORD('password') WHERE user='testuser';

ERROR 1146 (42S02): Table 'databasename_db.user' doesn't exist

mysql>
All users are stored in the mysql.users table, ie: the "users" table in the "mysql" database.

 

A safer method is to use the "set password" statement, rather than try to update the mysql.users table directly, i.e.:



Code:
set password for testuser = password('PA55W0RD!');






</div></blockquote>
 

I tried that and I still get an error that user doesn't exist: mysql> set password for testuser = password('password');

ERROR 1133 (42000): Can't find any matching row in the user table

 

This is what I used to create table and make a user:

 

 

Creating new MySQL User:

mysql > create database test_db;

mysql >GRANT ALL PRIVILEGES ON test_db.* TO 'testuser'@'localhost' IDENTIFIED BY 'testuser' WITH GRANT OPTION;

mysql> UPDATE user SET Password=PASSWORD('newpassword') WHERE user='testuser';

 

 

 

howtoforge

Reply
#7
Quote:<blockquote data-ipsquote="" class="ipsQuote" data-ipsquote-contentcommentid="15102" data-ipsquote-username="Dungeon-Dave" data-cite="Dungeon-Dave" data-ipsquote-timestamp="1315748409" data-ipsquote-contentapp="forums" data-ipsquote-contenttype="forums" data-ipsquote-contentid="4150" data-ipsquote-contentclass="forums_Topic"><div>
<blockquote data-ipsquote="" class="ipsQuote" data-ipsquote-contentcommentid="15092" data-ipsquote-username="feedmebits" data-cite="feedmebits" data-ipsquote-timestamp="1315549052" data-ipsquote-contentapp="forums" data-ipsquote-contenttype="forums" data-ipsquote-contentid="4150" data-ipsquote-contentclass="forums_Topic"><div>
mysql> USE databasename_db;

Database changed

mysql> UPDATE user SET Password=PASSWORD('password') WHERE user='testuser';

ERROR 1146 (42S02): Table 'databasename_db.user' doesn't exist

mysql>
All users are stored in the mysql.users table, ie: the "users" table in the "mysql" database.

 

A safer method is to use the "set password" statement, rather than try to update the mysql.users table directly, i.e.:



Code:
set password for testuser = password('PA55W0RD!');






</div></blockquote>
 

I tried that and I still get an error that user doesn't exist: mysql> set password for testuser = password('password');

ERROR 1133 (42000): Can't find any matching row in the user table

 

This is what I used to create table and make a user:

 

 

Creating new MySQL User:

mysql > create database test_db;

mysql >GRANT ALL PRIVILEGES ON test_db.* TO 'testuser'@'localhost' IDENTIFIED BY 'testuser' WITH GRANT OPTION;

mysql> UPDATE user SET Password=PASSWORD('newpassword') WHERE user='testuser';

 

 

The last bit is wrong - don't use "update user" to change the password directly.



Code:
[(none)] mysql> create database test_db;
Query OK, 1 row affected (0.02 sec)
[(none)] mysql> GRANT ALL PRIVILEGES
ON test_db.*
TO 'testuser'@'localhost'
IDENTIFIED BY 'testuser'
WITH GRANT OPTION;
Query OK, 0 rows affected (0.04 sec)

[(none)] mysql> set password for 'testuser'@'localhost' = password('PA55W0RD!');
Query OK, 0 rows affected (0.00 sec)




To test:



Code:
user@neptune:~$ mysql -u testuser --password=PA55W0RD!
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 451
Server version: 5.1.49-1ubuntu8.1 (Ubuntu)

[(none)] mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| test_db            |
+--------------------+
2 rows in set (0.00 sec)

[(none)] mysql> use test_db;
Database changed
[test_db] mysql> status
--------------
mysql  Ver 14.14 Distrib 5.1.49, for debian-linux-gnu (x86_64) using readline 6.1

Connection id:          451
Current database:       test_db
Current user:           testuser@localhost
SSL:                    Not in use
Current pager:          stdout
Using outfile:          ''
Using delimiter:        ;
Server version:         5.1.49-1ubuntu8.1 (Ubuntu)




 

The alternative is to set the pass during the user creation/grant:



Code:
[(none)] mysql> GRANT ALL PRIVILEGES
ON test_db.*
TO 'testuser'@'localhost'
IDENTIFIED BY 'PA55W0RD!'
WITH GRANT OPTION;
Query OK, 0 rows affected (0.04 sec)






</div></blockquote>
Reply
#8

strange it worked what you said: [(
none
)]
mysql
>

set
password
for

'testuser'
@
'localhost'

=
password
(
'PA55W0RD!'
);
Query
OK
,

0
rows affected
(
0.00
sec
)


 

Thanks :)

Just find it strange the first time I tried it it didn't work. I'll make an adjustment to my documentation :)

Learning something new every day :)

Reply
#9

Mysql is odd with its permissions structure - sometimes it takes the username, other times it takes username/hostname.

 

I think if you specify just username it assumes username@% (ie: any host) rather than a specific host.

 

I've always learned (for security reasons) to bind accounts to localhost unless remote access is required - and even then I'm cautious about locking down to an originating IP and restricting the amount of databases that account can access.

Reply
#10
ah ok :)thanks. Just a question. I was just looking through my documention and I remember I should have a look at setting up IDS too. Would it be smarter for me just to look a bit more into a apache first as in mod_ssl, etc or just set up IDS for security reasons and then continue looking into apache?
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)