Showing posts with label security. Show all posts
Showing posts with label security. Show all posts

Sunday, March 23, 2014

Grant execute on sql user

Back in the early days of sql server, stored procedures were much faster compared to normal queries. This meant that a typical system would host more than 200 stored procedures (hopefully on the same schema). In order to grant execute access to a role or user you can use the following snippet

Friday, January 3, 2014

Change unidentified networks to private

Working with Hyper-V in windows 8 you might need to change the private network location to private in order to access the host's web server from a client virtual machine (e.g. testing a site in older browsers). By default, the private network doesn't contain any domain controller or dns server and you might have static ips on your vms and the host. This means that by default the connection's location is public as the network is unidentified. To change the location of your unidentified networks to private, I found a powershell script.

Saturday, September 7, 2013

IE11 and ASP.NET Session cookies


I have just upgraded to IE11 and although it’s really awesome I had some weird issues with some MVC applications I am using. The problem occurred with the authentication cookie and the session id being stored in the URL. Although I explicitly enabled cookies for my custom applications’ URLs, the session id and the asp.net authentication token would still persist in the URL. This broke the POST requests as the server could not authenticate the request (the token was not posted in neither the URL nor a cookie) and would return a 401 response.

According to a discussion in msdn there seems to be an issue with the new user agent string (most sites don’t recognize the new IE) and thus the MVC doesn’t enable cookies. In order to explicitly force the use of cookies in the authentication token add the cookieless attribute in your forms authentication element as follows:

<authentication mode="Forms">
  <forms loginUrl="~/YourLoginUrl" timeout="2880" cookieless="UseCookies" />
</authentication>

Wednesday, October 3, 2012

Building openSSL on windows

In order to build openSSL from the source code you will need to install a couple of third party free software. In this post I describe what I did on a virgin windows pc in order to build openSSL 1.0.1c.

Windows Autologin

Sometimes you might need to set a user password although you don’t really need to. The most common reason to set one is to allow the user to connect through remote desktop. This will force you to authenticate every time you boot the machine. In order to avoid that (please make sure you do understand the security risks of doing that, I personally use this only on my virtual machines and only if I don’t care about securing my files) you can follow these simple steps.

Saturday, October 15, 2011

Create user and db in MySQL for various apps

Working on a portal which requires the integration of various opensource applications, I had to install quite a few systems that require mysql databases. In order to keep a safe separation between these systems, one should create different users that will have access only to the specific database. This is a simple way to prevent losing all your databases in case of  the mishap when an attack is successful on a system and sql commands pass directly to the database (sql injection etc). This is a how-to create the new user, the new database and set the requested permissions.

Wednesday, September 28, 2011

Reset mysql 5.1 root pass

I had to install a couple of dbs on a mysql server which refused to recognize me as its root… I kept receiving the following not-so-friendly message:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
As it turns out, something was messed up during the installation and mysql did not recognize the given root password (mistype perhaps?). Anyway, I had to reset the pass, and this is how I did it.

Friday, June 10, 2011

Securing Asp.net applications by hidding response header

Although it’s fairly obvious that a website is running asp.net (through session cookie and the viewstate) you may protect your server by removing a few response headers that advertise the iis and the asp.net version. The most common response headers you should remove are the following:
  • X-Powered-By:ASP.NET
  • X-AspNet-Version:*.*.*
  • Server:Microsoft-IIS/*.*