70 pts.
 How do I avoid a security exposure using XP_SendMail
I'm using XP_Sendmail in a trigger on my database. In order to run the trigger, I have to give database access to the "guest" user. I'm concerned about security. I've tried a Stored Proc called SP_Sendmail that calls XP_Sendmail, but I still have to grant db access to the "guest". Any help here would be appreciated. Thanks, Arlin

Software/Hardware used:
ASKED: February 9, 2009  4:37 PM
UPDATED: February 17, 2009  11:30 PM

Answer Wiki:
Create a 'service account' in SQL that has just the rights and permissions necessary to execute the 'XP_SendMail' Stored Procedure. This will satisfy your security requirements of not granting access to the guest account.
Last Wiki Answer Submitted:  February 12, 2009  12:29 am  by  Johro10   75 pts.
All Answer Wiki Contributors:  Johro10   75 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

Can you provide more information about what you are trying to do with the xp_sendmail? I assume because you are using xp_sendmail you are using SQL 2000?

By granting the guest account access to the database, you will be granting anyone who accesses your SQL Server access to what ever rights the roles you have assigned the guest account (public by default, but you may have granted other roles). In otherwords you have have setup yourself with a security problem. What roles did you grant the guest account? What rights have you granted the public role by default?

Is there any reason that the email must be sent when the trigger runs, and couldn’t be sent later on via a scheduled job?

 64,550 pts.

 

Johro,
Not when the xp_sendmail is being called via a trigger.

 64,550 pts.

 

I’ve been away and just now catching up on the thread.
I’ll try the “service account” approach tomorrow.
Thanks,
Arlin

 70 pts.