Forcing use of SSL at login screen

Post support questions that directly relate to Linux/Unix operating systems.

Moderators: Developers, Moderators

Post Reply
James Austin
Posts: 5
Joined: Thu Sep 26, 2002 12:37 pm

Forcing use of SSL at login screen

Post by James Austin »

I've got Cacti working fine on RH 8.0 and Apache 2.0.

What I'd like to know is has anybody had any success forcing SSL login??

i.e. sending anyone who accesses cacti to https://cacti/ even if they use http://cacti/ instead.

I'm using this on a college campus and I'd prefer not passing the pwd in the clear.

If so how'd you do it.

I've tried redirects and .htaccess with no luck.

Thanks in advance for any help.

..jwa
Erik
Posts: 1
Joined: Thu Jan 02, 2003 11:51 am

Post by Erik »

You can use this (i think its should work, but it's not tested):

Code: Select all

<?php
//this should be before any output has been started, you can place
//it in an every-time-included file like ./include/config.php.

if($_SERVER['SERVER_PROTOCOL'] != 'https') { 
	header ('Location: https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']); // This wil put a redirect in the header (configure if you have a different setup) (you could use $_SERVER("
	die(); // Don't offer anything over a non-ssl conn., so stop!
}
?>
If it works, it's working safely. I'm convinced. You don't need reg_globals to be on in php.ini.

Hope it helps!![/code]
Grtz,
Erik
Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests