Koozali.org: home of the SME Server

Obsolete Releases => SME 7.x Contribs => Topic started by: AlexG on October 29, 2007, 06:37:16 AM

Title: htaccess
Post by: AlexG on October 29, 2007, 06:37:16 AM
Hi

I have a 7.2 SME Version and tried to install the e-smith-htaccess rpm. While installing this rpm some errors occured. But this package appears in the installed software, but does not work. Who has experience with this htaccess?
Title: Re: htaccess
Post by: raem on October 29, 2007, 07:19:04 AM
AlexG

You don't say what versipn rpm, but my guess is that it is not compatible with 7.x.
You don't need an rpm, see
http://wiki.contribs.org/Htaccess_configuration
Title: Re: htaccess
Post by: AlexG on October 29, 2007, 09:00:10 AM
Hi

Thank you for the quick answer.
I am working on this how to, but this line does not work: /etc/e-smith/events/actions/restart-httpd-graceful
It appears 'command not found'
Title: Re: htaccess
Post by: raem on October 29, 2007, 09:22:45 AM
AlexG

Quote
/etc/e-smith/events/actions/restart-httpd-graceful 'command not found'


This should do it.

sv t /service/httpd-e-smith

Then to check the service has restarted correctly

sv s /service/httpd-e-smith


Howto updated
Title: Re: htaccess
Post by: AlexG on October 29, 2007, 09:34:14 AM
I tried it but it does not work:

sv t /service/httpd-e-smith <enter>
sv s /service/httpd-e-smith <enter>
run: /service/httpd-e-smith: (pid 5370) 8s, normally down
/etc/e-smith/events/actions/restart-httpd-graceful <enter>
-bash: /etc/e-smith/events/actions/restart-httpd-graceful: Datei oder Verzeichnis nicht gefunden (File or Folder not found)
Title: Re: htaccess
Post by: raem on October 29, 2007, 10:08:12 AM
AlexG

Quote
sv t /service/httpd-e-smith <enter>
sv s /service/httpd-e-smith <enter>
run: /service/httpd-e-smith: (pid 5370) 8s, normally down

That looks like it "worked" correctly to me.
You restarted the service with sv t .... and checked it was running with sv s.... which says the service has been running for 8 seconds since you restarted it.


The above commands replace the old command, so do not run the old command anymore as it is deprecated.
ie do not use
/etc/e-smith/events/actions/restart-httpd-graceful <enter>

Title: Re: htaccess
Post by: AlexG on October 29, 2007, 10:34:47 AM
Nearly fine - The login screen appears - but does not accept the password. I have checked for any typo error - without success.
What does the row '/sbin/e-smith/expand-template /etc/httpd/conf/httpd.conf' mean? Do I have to write this after every changes?
Title: Re: htaccess
Post by: raem on October 29, 2007, 10:58:26 AM
AlexG

Quote
What does the row '/sbin/e-smith/expand-template /etc/httpd/conf/httpd.conf' mean? Do I have to write this after every changes?

You only run that command to expand the template once, immediately after creating the custom template.


Quote
Nearly fine - The login screen appears - but does not accept the password.

Did you create the user/password file by carefully following the instructions given ?

Title: Re: htaccess
Post by: AlexG on October 29, 2007, 11:24:35 AM
Yes I did and the Browser is asking one folder up than specified.

<Directory /home/e-smith/files/ibays/ibayname/html/project/_name/html>
  AuthUserFile /etc/passwd
  AuthGroupFile /dev/null
  AuthName "Name"
  AuthType Basic
  <Limit GET>
    order deny,allow
    require valid-user
  </Limit>
</Directory>

I compared this with /etc/httpd/conf/htpd.conf - it's the same
Created the /etc/passwd with 'cd /etc; htpasswd -c passwd user1'  :-?
Title: Re: htaccess
Post by: raem on October 29, 2007, 12:02:03 PM
AlexG

Quote
Yes I did and the Browser is asking one folder up than specified.
<Directory /home/e-smith/files/ibays/ibayname/html/project/_name/html>

Check your configuration carefully.

I followed the howto (with the revised sv t ... command) and it works OK on a sme7.2 server
ie to
/home/e-smith/files/ibays/testibay/html/folder1/testfolder

When I browse to
www.mydomain.com/folder1/testfolder
I get asked to login, I supply the user name and password I entered into the password file and I get access OK.
Title: Re: htaccess
Post by: AlexG on October 29, 2007, 12:09:58 PM
I will check it carefully. One last question: How can I delete these changes to the originating (after deleting this folder)?

Thanks a lot, have a nice day!
Title: Re: htaccess
Post by: raem on October 30, 2007, 02:10:42 AM
AlexG

Do the reverse process, that's the beauty of custom templates changes.
ie
delete the custom template you added
expand the template
restart httpd-e-smith

delete the password file

Title: Re: htaccess
Post by: AlexG on October 30, 2007, 02:27:05 AM
Hi

Do you mean with restarting 'sv t /service/httpd-e-smith <enter>'?

After this the server was down - I did 'sv t /service/httpd-e-smith <enter>' again and nothing happened and there was no way to reboot the server. Is witched him off. Started again - many errors occurred :shock:. I have deleted the 50AddSecureIbayFolder File, I have edited the http.conf file and it seems to work again.

The way is?
- Editing the custom template
- Expanding the template with '/sbin/e-smith/expand-template /etc/httpd/conf/httpd.conf <enter>'
- restarting the httpd-e-smith with 'sv t /service/httpd-e-smith <enter>'
Title: Re: htaccess
Post by: raem on October 30, 2007, 02:56:21 AM
AlexG

The command syntax is slightly different in sme7, so you can do the following (replacing file names with those you used of course)

rm /etc/passwordfilename
rm /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf 50AddSecureIbayFolder
expand-template /etc/httpd/conf/httpd.conf
sv t /service/httpd-e-smith

It is recommended practise to check that the service did actually restart and is running, with
sv s /service/httpd-e-smith


Quote
The way is?
- Editing the custom template
- Expanding the template with '/sbin/e-smith/expand-template /etc/httpd/conf/httpd.conf <enter>'
- restarting the httpd-e-smith with 'sv t /service/httpd-e-smith <enter>'

Yes, but in sme7 you can leave out the /sbin/e-smith/ part ie

'expand-template /etc/httpd/conf/httpd.conf <enter>'
Title: Re: htaccess
Post by: AlexG on October 30, 2007, 03:14:48 AM
[root@sme-1 httpd.conf]# rm campasswd
[root@sme-1 httpd.conf]# rm 50AddSecureIbayFolder
[root@sme-1 httpd.conf]# expand-template /etc/httpd/conf/httpd.conf
[root@sme-1 httpd.conf]# sv t /service/httpd-e-smith
[root@sme-1 httpd.conf]# sv s /service/httpd-e-smith
run: /service/httpd-e-smith: (pid 4757) 10s, normally down

Sorry, but from this point the server is doing nothing anymore. I can not reboot or shutdown. I have to switch him off and boot again.

Best regards
AlexG
Title: Re: htaccess
Post by: raem on October 30, 2007, 03:58:53 AM
AlexG

Did you uninstall the rpm ?
rpm -e e-smith-htaccess

I can only think that you may have inadvertantly added another custom template somewhere and that is causing problems, check the custom template location mentioned in the Howto very carefully.
Also you said earlier you were editing the httpd.conf file. That is not good practise as that file is created from the contents of the templates/dbs. You may have inadvertantly changed something there that is also causing problems.

To "reset" your system, delete any custom templates you have added and then do
signal-event post-upgrade
reboot

Your system should then return to default settings.
Then proceed carefully to create the custom template as per the Howto.


I have also updated the Howto in the Wiki, see
http://wiki.contribs.org/Htaccess
Title: Re: htaccess
Post by: AlexG on October 30, 2007, 04:15:13 AM
Hi Ray

Thank you for your kindness. Your Wiki is great and clear. The 'rpm -e e-smith-htaccess' is not installed on my server. Do I have to install it? Please be so kind and write the link in the Wiki and where to download from (the Link in the old howto does not work).

Best regards
AlexG
Title: Re: htaccess
Post by: raem on October 30, 2007, 04:31:50 AM
AlexG

You wrote earlier:
Quote
I have a 7.2 SME Version and tried to install the e-smith-htaccess rpm.


I was telling you to uninstall it, in case the earlier install you did was causing problems.

do
man rpm
to see the syntax for the rpm command
ie
rpm -e rpmname
does a removal or uninstall.

Title: Re: htaccess
Post by: AlexG on October 30, 2007, 07:02:00 AM
Quote
then do
expand-template /etc/httpd/conf/httpd.conf
sv t /service/httpd-e-smith
It is recommended practice to check that the service has started and is running, so do
sv t /service/httpd-e-smith
[edit] Password file creation
Now you need to create the password file, change to the location you want the password file in

Please correct in the Wiki:
It is recommended practice to check that the service has started and is running, so do
sv t /service/httpd-e-smith  -->  sv s /service/httpd-e-smith
Title: Re: htaccess
Post by: raem on October 30, 2007, 07:40:28 AM
Fixed
Title: Re: htaccess
Post by: raem on October 30, 2007, 03:26:35 PM
AlexG & all

I have further updated the htaccess howto, by adding sections on authenticating against all or some valid sme users, as well as against a user/password file.
See
http://wiki.contribs.org/Htaccess
Title: Re: htaccess
Post by: shell on October 31, 2007, 02:31:16 AM
might be of interest - I saw a bit of code (kudos to cactus  8) ) for authenticating against groups using htacess too, although i am not sure how this would integrate - include at the top of the custom template before directives read, maybe then when expanded would be run.  obviously i haven't tried it myself yet- but i can see this would be quite useful implemented.  Will fire a question in that forum to see if cactus will elaborate...

http://forums.contribs.org/index.php?topic=38959.msg177464#msg177464