Tune up your web site

NOT ALL PAGES ARE CONVERTED TO CELL PHONE FORMAT!

Home      Sitemap

www.diy-computer-repair.net logo

Fine tune your web server

Ok, you have your web site up and running, you have visitors and the bots a coming to visit, so why fine tune your web server?

After finally getting this web site back on line, all the nitty-gritty stuff done I looked at the logs to see what the server and web sites were doing, in a way I was shocked and in another I knew that my web sites would be hacked (or least someone would try) because I have a static IP and it has been advertised for over fifteen years...

Fine tune your web server

You could leave it alone however have you looked at the web site logs?

Have you set up the logging yet?

In the log for today how many entries have this word in it: bot

I use Notepad++, when I high light bot I see loads of entries that are a search engine bot come to index my site, now that is great! Ahhhh, maybe, maybe not...

Did you know there are bots from "search engines" that will copy your content? Especially images, pdf's, or archive files such as zip, rar, gz.

When I see a bot stop by my site and the list is all images (.gif, .png, .jpg and .avi) I became suspicious, I searched for and found an article or two that explain why a bot is only searching for images or video... They are stealing the content!

You may want to search for this term also: request filtering

Also look at your Logging module and change some of the parameters that are logged, you specially want to log "User_agent", and if it isn't set you may want to do it daily vs weekly, also un-check the "Do not create new log files" and then keep an eye on those logs.

Fine tune your web server

How about your Server Event Log,?

Specifically "Security", buy that I mean filter the log for "Audit Fail" if you see a lot of failures look at the text of the failure. When you look at the text do you see:

Account for Which Logon failed:

Under that Account Name: Administrator

Then under Failure Information you will see Failure Reason: Unknown user name or bad password

At the time I discovered this there had been over 1500 entries and the server had been on the line and connected to the internet for under two hours!

Time to take action!

What did I do besides disable the nic for the router to stop the incessant bombardment of the Administrator's user ID? I proceeded to turn off all the open ports that M$ opens to ANY connection!

 Having done my "Best Practice" of renaming the account Administrator to something else and set the password with complexity that wasn't the problem, the problem was the Web server was visible to any port! Not limited to ones I would be using. Someone was running a dictionary attack on that user ID, I counted twenty different IP address before I clear the log and went on to work on the firewall...

Fine tune your web server

A story of two failures:

In early twenty-nineteen my blog was hacked, more than likely a young inexperienced hacker because all that they did was put a bunch of nonsense links in the content. However it was so bad that using MySQL and a few query's I couldn't clean it out. I could have deleted the web site from MySQL and used by back up bit I was so disappointed in myself I shut it down.

After that I went though all pages on this web site and didn't see any problems.

What I need to do was find out where my failure was - it was not the server or the firewall... It was the blog software that let a bogus user id and password through... Even though I had the software set that all users had to be approved.

That was when I decided I needed to upgrade Wordpress and with that PHP. My problem was I was running Server 2003 and IIS 6. Wordpress 5.4+ would not load on IIS 6.

To keep my site I had to upgrade the Server OS, well ok, I found Server 2008 R2 faily cheap (by cheap, get cheap -- look familiar?). I backed up my web sites and proceeded to install the newer OS, the computer I was using was a fairly old ASUS Laptop with a Core 2 Quad that ran at 2.5 GHz and has 8 GB of ram. Server 2008 R2 loads and runs quite well, IIS 7.5 loads and runs... kinda. It is too slow, so I decide to leave that OS in that laptop and install another 2008 R2 I a have (I bought 3 cd's with 5 CAL license) on another ASUS Laptop with an i5 2.5 GHz processor and 8 GB of memory. I install IIS 7.5 and copied both web sites to the install, they run fine and the computer doesn't drag. Ok, up grade PHP and Wordpress, all working fine.

Then comes the proverbial curve ball: H T T P is dead, long live HTTPS! I have had this web site since 2007 and with the ups and downs you experience with a web site well... you know (if you would like to read the history of this web site see the About Me page).

I go through the change over to HTTPS, IIS 7.5 will not support more than one web site and certificate on port 443! I found some work around articles... none worked for me so I upgraded to Server 2016.

A little long winded with the why, now to the cure:

I went to tune the Firewall settings a had a look around, all the "Default" settings for inbound are set for ANY / ANY that means that the rule might say "Email Account" however instead of the inbound rule saying port 25 it was set for ANY port! Same for the outbound.

So basically all ports were open!

From port 0 to port 64,848 were open to anyone who wanted to connect! Nice, a hackers dream come true.

Want to know what is open on your server before you do any work? Try this: netstat /a /o /n

Quite a list, eh? (Hint: if a port is open but no connection you will see "listening"; if it is connected you will see the ip of your nic and the address of the connecting computer/service and the port number.

What I did on the inbound side was to "Disable" not delete each rule. At first I deleted a bunch of rules then ran the netstat, no change those ports were still open. I reloaded the default rules and then went through some and disabled them. After running the netstat again the list was shorter.

I had tuned about half the list just before my Wife called time one (time to turn off the lights...) but --

When I opened up the firewall interface in the morning a lot of the rules I disabled were back to enabled, and a couple I deleted (XBox, ect) were back!

The only thing I could think of that could have done that was an update from M$ because the internet nic was still disabled and the local network nic goes through a proxy to get to the internet.

Because this is a dual homed computer I want to be able to ping it when it restarts or if I think it is having problems so the private network side will get a little more open ports than the internet side.

Fine tune your web server firewall

After disabling all the rules I went back and did this with the rules I wanted to open on the network side:

To use ping from my computer to the web server on the network side I had to open the "File and Printer Sharing Request ICMPv4-in"

Firewall rule for ping on TCP v4

As you can see the port is wide open to anyone...

Firewall settings fo pin on TCP v4

Fine tune to keep the computer from replying I use the Scope page to limit what IP that the service can listen on. You can use one IP or a range for the block "These IP Addresses".

(Note: I have the router set to ignore ping requests, however that is for the ISP address, this server is in a DMZ and will respond, well it did now it won't! Now that is fine tune...)

Firewall settig for the scope for pig on TCP v4

 

Internet side:

Sample of a rule that is disabled:

Blocking the inbound for Cast...

As you can see the port that is open on this rule is 2177, one of the few with an actual port.

Block cast port 2177

Because I don't use any of the rules on my network side it will not effect what I do from that side of the firewall.

Scope for cast

Fine tune for this one I made for my email server, it only needs one inbound port.

inbound rule for hMailServer

The port is 587...

Port open for hMailServer

The internet side open ports I have are:

Port 80 (I may close the inbound rule soon, you can only connect to my sites with SSL ie: HTTPS)

Port 443

Port 587

Port 995

How did I solve the problem with the Firewall Rules reverting? On the Firewall app Advanced page in the right hand column are a few words: Export Policy and Import Policy

I have done the export after each batch of changes, I have not done an import yet however the rules have not changed since the first time. (And I make images frequently of the system and web drives...)

A short story:

My email server was having problems connecting and saying connected when I was setting it up. I used telnet to connect, sometimes it connected and then it stopped connecting. It was driving me crazy, it would connect yesterday all day fine, then the next morning it would not connect. I fiddled with fine tune the firewall for three days, uninstall, reinstall, configure, reconfigure...

Then I decided to make an image of the System drive and the Web drive, when I was done I restarted the computer. The email was working before I shut it down to do the images, now on restart it doesn't work. I was having another problem with another service that would't fine tune and did a search on why some network service applications with a service that starts on startup would drop off.

I  find out some network apps with a service that starts on startup will disconnect (and still be running!) if there isn't any network connectivity.

I stop the email service then start it, I can telnet into the email server... So I did a little search on delay time for autostart a service, you can set the delay in micro seconds from 100 to as far as 60000, 100 microseconds to a full minute (there article and some comments left me with the feeling it could be a higher amount of time). So I set it for autostart delay, will see in the next day or two if it still drops off may have to do some more fine tune.

So if you are having difficulty with fine tune an application you may want to look at using the startup autodelay.

Fine tune your web server and don't want just any "search engine" indexing you web site?

You may want to search for this term also: request filtering

You can turn this feature on with the Server Manager, however it is limited in it's use unless you happen to know how to use powershell or VBScript. I don't however I did find a nice article on using this feature to block bad neighborhood bots!

I followed the article and setup the request filtering, add the script provided by the author, added a bot that the only thing the bot did was search the images, and now when it stops by the log shows a 404 for it. Cool! Bock hackers, DoS attacks and bad bots... now that is a fine tune of my web sites!


Emergency Repair
D
isk (ERD) - Will Yours Work?

Emergency
Repair Disk


Custom made for you...



You keyboard isn't thirsty, and it doesn't need calcium. Milk and other liquids will ruin a keyaboard!


This Web
Site is a
labor of Love
!
But Love
doesn't pay
the bills!

Please chip in $5 to keep it live...
use your card...

NOTE: Checklists and manuals are temporally off line...
Need A Checklist?

Need A Repair Manual?


    Page copy protected against web site content infringement by Copyscape
 

You can:


Return to
previous page:



Note: Adobe has stopped production / update of the Flash program, until I find a suitable replacement videos on this web site will not run, the blank space is a place holder for those videos...


 

 

 

 


Thank you for visiting my web site, and please come back again.

This website is not intended for children under the age of 18.

Author of this web site: Monte Russell


FTC Endorsement Rules

All testimonials on the DIY Computer Repair web site are from
customers who were not paid to comment on any products!


The Flag of The United States of America!   Proudly Made in The U. S. A.

Copyright and Registered to www.diy-computer-repair.net, all thieves will be prosecuted to the fullest extent of international law!www.diy-computer-repair.net
From the Desert South West ~ Arizona, U. S. A.
Copyright DIY-Computer-Repair.Com 2006-2025




Return to top of Fine tune your web server

Fine tune your web server, this web site has been back up and running since June 4, 2021.




Home    About    Sitemap

From the Desert South West ~ Arizona, USA
Copyright www.diy-computer-repair.net 2006-2021