Posts tagged debian

How to setup lighttpd with a self signed ssl cert on debian with multiple host’s using name based virtual hosting.

Now first off let me say I take no responsibility if this works for you or not.

Also please note that this will only use the one self signed cert we’re going to make across all hosts, which is still encryption, just looks funny if your hosting for more then one business, being all the site’s I have on my server are my own, I don’t really care I just wanted some ssl encryption on my logins to my blogs and pages where I don’t want to send data in the clear. So going to https://stinebaugh.info will give you the same cert as going to http://twig.gs will, but they are still secure.

First off let’s create our self signed certificate. Yes this will throw your browsers into a panic but if you save your exception to the warning permanently (which is fine) you’ll only see it once, plus it’s free ;)

[codesyntax lang="bash" bookmarkname="Generate a self signed pem file"]

sudo openssl req -new -x509 -keyout selfsigned.pem -out selfsigned.pem -days  3650 -nodes

[/codesyntax]

This will  then ask you a bunch of questions that you can fill out for yourself, the one that matters is the -> Common Name (eg, YOUR name) []: prompt which is asking for the exact domain name you plan on using (eg. stinebaugh.info) and will create a .pem file in whatever directory your in (so choose a non web accessible folder like /etc/lighttpd/ for it as this is a secret!) the expiration date of the cert file is noted in my example using 3650 which will generate a cert that’s good for 10 years! (hey it’s self signed, do I really want to do this every year?!) Feel free to change it as you see fit.

Now let’s lock that file down with some permissions.

[codesyntax lang="bash" bookmarkname="chpwn that pem file!"]

sudo chown www-data:www-data selfsigned.pem

sudo chmod 600 selfsigned.pem

[/codesyntax]

Now being debian is awesome as well as lighttpd, you can just enter in the command

[codesyntax lang="bash" bookmarkname="bash"]

 sudo lighty-enable-mod ssl

[/codesyntax]

and it will enable the ssl extention for lighttpd!

now let’s setup lighttpd’s ssl conf.

[codesyntax lang="bash" bookmarkname="edit lighttpd's 10-ssl.conf"]

cd /etc/lighttpd/conf-enabled/
sudo nano 10-ssl.conf

[/codesyntax]

and it should look something like this.

[codesyntax lang="bash" bookmarkname="10-ssl.conf lighttpd ssl setup"]

$SERVER["socket"] == “0.0.0.0:443″ {
ssl.engine                  = “enable”
ssl.pemfile                 = “/etc/lighttpd/selfsigned.pem”
server.document-root = “/var/domain/http” #or wherever you web directory is so it doesnt display just the lighttpd default
}

[/codesyntax]

now restart lighttpd

[codesyntax lang="bash" bookmarkname="restart lighttpd"]

sudo /etc/init.d/lighttpd force-reload

[/codesyntax]

your lighttpd server should now reboot without any errors you can check the syntax for errors if you want by entering in

[codesyntax lang="bash" bookmarkname="check lighttpd's configuration file for errors"]

sudo lighttpd -t -f /etc/lighttpd/lighttpd.conf

[/codesyntax]

now try your server by viewing a page using https such as https://stinebaugh.info and viola you should get that warning in your browser like I was saying and it shoud be just fine after you accept it!

Your Welcome!

Getting the Linksys WPSM54G Working on Linux and Windows 7!

First off this post is more for my own remembrance then informational and is aimed at the more advanced user then just putting in the disk and following the directions  (which will work just fine if you are running Windows Vista but not 7) however I was having issues getting this to work on linux as well as logging in to the web interface where this will mostly be taking place.

First before you can get to it wirelessly you will need to set up the Print Server. Attach it to your Router directly (wired). (I recommend anything running DD-WRT as I’ll be using this in my descriptions to follow. More on this in a bit.) After it’s attached Power it on.

Once the light’s turn green, head on over to your browser and login to your routers interface and head on over to the “Status” Tab.

Find and click on the “LAN” Sub-Tab and look for your Linksys Print Server and make note of it’s IP. (Mine is named LKEED64C don’t ask me why and for this walkthroughs sake we’ll assume it’s on IP 192.168.0.555)

Now that you’ve found the IP go ahead and open another tab in your browser (ctrl+t) and browse to the web interface at [codesyntax lang="text"]

http://192.168.0.555

[/codesyntax]

This will bring up the first page asking for your password. The default username is blank and the password is “admin” Please for god’s sake, CHANGE THE DEFAULT PASSWORD!!!

After you’ve changed the password go to the “Protocol” page and set your IP to be static. (special note to those running DD-WRT if your network is mostly dynamically assigned the IP’s if you set your server’s IP out of the normal range it will remain static and you don’t have to worry about collisions if another device takes it) Go ahead and set it for your network. In my example the IP would be 192.168.0.555 Netmask would be : 255.255.255.0 and Gateway would be the router at IP 192.168.0.1 and then click Save.

Now click the wireless tab and set your SSID to whatever your’s is, click save then do the same for your security tab. I won’t be of much help posting my info here as you should already know that information.

Now you can disconnect the power to the linksys print server and the Ethernet cable, move it to wherever your printer is located, and hook up the printer then power back on the print server.

Your Print Server is now ready to be put into action!

Now to get your Linux-Mint, Ubuntu, Debian or such laptop out and let’s get it printing!

Open your Menu and go to Administration>Printing. Select New>Printer. Once the Select Device window pop’s up, Select “Other” and in the “Enter device URI” window enter in this: [codesyntax lang="text"]

ipp://192.168.0.555/ipp/P1

[/codesyntax]

You should then be asked what type of printer is attached for CUPS to install the proper drivers, and then you should be able to print a test page! Your Linux install can now print wirelessly anywhere!

Now for Windows 7 users getting connected to the printer. First off, I recommend having already hooked up the printer to your system beforehand and have the proper drivers for your printer already installed it just makes things easier.

Click your start menu and select Printers and Devices. Then right click inside the window and select Add a new printer, then Select Networked Printer. It will start scanning for attached networked printers, but it doesn’t find mine so I just click stop and select the “The printer that I want isn’t listed.”

Select the radio button that says”Add a printer using TCP/IP blah blah blah” and click Next.

For the Hostname enter in your Print Server’s IP of 192.168.0.555 and click Next.

Let it query the Printer for drivers automatically.

The Additional Port Information needed window should pop up just keep it selected at “Generic Network Card” and click Next. Select your printer from the drivers list and click next, if you have already installed them just keep the one’s you have (it says it’s recommended anyways)

Then just name your printer (I like to add “(NETWORKED)” to the end of mine to keep it easily identifiable) and you should be able to print a test page to confirm that everything works! (I have it set as the default printer. It’s up to you if you choose to do the same)

And now you should be able to print from both new OS’s using the Linksys WPSM54G wirelessly! Phew!