SlideShare a Scribd company logo
1 of 16
Download to read offline
SQL SERVER 2017 Eduardo Piairo
@EdPiairo
#PortoDataCLR
ABOUT ME
SQL Server 2017 CLR
@EdPiairo, #PortoData
@EdPiairo
https://pt.linkedin.com/in/jesuspiairo
eduardopiairo@gmail.com
http://www.eduardopiairo.com/
Eduardo Piairo
Friend of Redgate
Operations Engineer
DevOps Porto Founder
INDEX
1. What’s CLR
2. Enable CLR
3. Security (Host Policy)
4. 2017 Breaking change
5. CLR strict security
SQL Server 2017 CLR
@EdPiairo, #PortoData
WHAT IS CLR?
SQL Server 2017 CLR
• .Net runtime engine (CLR) was for first integrated in SQL Server 2005
• This integration allows the execution of code within the context of a query
• This integration is commonly referred as SQLCLR (Microsoft call it CLR integration)
• CLR integration allows to incorporate code written in .Net language into SQL Server engine
• Can be called from a stored procedure or function
• Stored procedures, triggers, user-defined functions, user-defined types, and user-defined aggregates can be
created in managed code
• Does not interact directly with SQL Server (needs to connect to database)
@EdPiairo, #PortoData
WHAT IS CLR?
SQL Server 2017 CLR
• Framework that bridges the environment of the SQL Server database engine
with the rich programming environment of .NET
• Extending capabilities of queries beyond T-SQL built-in functions
• Performing certain operations faster or easier than using T-SQL
• Better interaction with external resources (better then xp_cmdshell)
@EdPiairo, #PortoData
ENABLE CLR
SQL Server 2017 CLR
• EXEC sp_configure ‘clr enabled’, 1; RECONFIGURE;
• EXEC sp_configure ‘clr enabled’, 0; RECONFIGURE;
• 0 - Assembly execution not allowed on SQL Server
• 1 - Assembly execution allowed on SQL Server
@EdPiairo, #PortoData
SECURITY
SQL Server 2017 CLR
• CLR supports Code Access Security (CAS) as security model
• The permissions granted to assemblies are defined in 3 different places:
• Machine policy
• User policy
• Host policy
@EdPiairo, #PortoData
HOST POLICY
SQL Server 2017 CLR
• CAS permissions granted to assemblies are determined by the permission set
specified when creating the assembly (PERMISSION_SET)
• SAFE
• Only internal computation and local data access are allowed
• Most restrictive permission set
• Assembly cannot access external system resources such as files, the network, environment
variables, or the registry
@EdPiairo, #PortoData
HOST POLICY
SQL Server 2017 CLR
• CAS permissions granted to assemblies are determined by the permission set
specified when creating the assembly (PERMISSION_SET)
• EXTERNAL_ACCESS
• Have the same permissions as SAFE
• Ability to access external system resources such as files, networks, environmental variables, and
the registry
@EdPiairo, #PortoData
HOST POLICY
SQL Server 2017 CLR
• CAS permissions granted to assemblies are determined by the permission set
specified when creating the assembly (PERMISSION_SET)
• UNSAFE
• Unrestricted access to resources, both within and outside SQL Server
• Code executing from within an UNSAFE assembly can also call unmanaged code
@EdPiairo, #PortoData
2017 BREAKING CHANGE
SQL Server 2017 CLR
• CAS is no longer supported as security boundary
• SQL Server new option: clr strict security
@EdPiairo, #PortoData
CLR STRICT SECURITY
SQL Server 2017 CLR
• EXEC sp_configure ‘clr strict security’, 1; RECONFIGURE;
• EXEC sp_configure ‘clr strict security’, 0; RECONFIGURE;
• 0 – Disabled
• Provided for backwards compatibility
• Not recommended
• 1 – Enabled (default)
• Causes the Database Engine to ignore the PERMISSION_SET information on the assemblies, and
always interpret them as UNSAFE
@EdPiairo, #PortoData
CLR STRICT SECURITY
SQL Server 2017 CLR
• All assemblies (SAFE, EXTERNAL_ACCESS, UNSAFE) are authorized for
UNSAFE access
• Set database as TRUSTWORTHY;
• Assembly is signed with a certificate that has a corresponding login with UNSAFE
ASSEMBLY permission
• Assembly is signed with an asymmetric key that has a corresponding login with UNSAFE
ASSEMBLY permission
• Trusted assembly list (sys.sp_add_trusted_assembly; sys.sp_drop_trusted_assembly)
@EdPiairo, #PortoData
DEMO
SQL Server 2017 CLR
@EdPiairo, #PortoData
REFERENCES
https://docs.microsoft.com/en-us/dotnet/framework/data/adonet/sql/introduction-to-sql-server-clr-integration
http://www.sqlservercentral.com/articles/Stairway+Series/104406/
https://docs.microsoft.com/en-us/sql/database-engine/configure-windows/clr-strict-security
https://docs.microsoft.com/en-us/sql/database-engine/configure-windows/clr-enabled-server-configuration-option
https://docs.microsoft.com/en-us/sql/relational-databases/clr-integration/security/clr-integration-code-access-security
https://docs.microsoft.com/en-us/sql/relational-databases/system-stored-procedures/sys-sp-add-trusted-assembly-
transact-sql
https://docs.microsoft.com/en-us/sql/relational-databases/system-stored-procedures/sys-sp-drop-trusted-assembly-
transact-sql
https://docs.microsoft.com/en-us/sql/database-engine/breaking-changes-to-database-engine-features-in-sql-server-
2017
http://www.nielsberglund.com/2017/07/23/sql-server-2017-sqlclr-white-listing-assemblies/
SQL Server 2017 CLR
@EdPiairo, #PortoData
Q&A
SQL Server 2017 CLR
@EdPiairo
https://pt.linkedin.com/in/jesuspiairo
eduardopiairo@gmail.com
http://www.eduardopiairo.com/
@EdPiairo, #PortoData

More Related Content

What's hot

Hardening Apache Web Server by Aswin
Hardening Apache Web Server by AswinHardening Apache Web Server by Aswin
Hardening Apache Web Server by Aswin
Agate Studio
 

What's hot (20)

Secret Management Architectures
Secret Management Architectures Secret Management Architectures
Secret Management Architectures
 
Neil Saunders (Beamly) - Securing your AWS Infrastructure with Hashicorp Vault
Neil Saunders (Beamly) - Securing your AWS Infrastructure with Hashicorp Vault Neil Saunders (Beamly) - Securing your AWS Infrastructure with Hashicorp Vault
Neil Saunders (Beamly) - Securing your AWS Infrastructure with Hashicorp Vault
 
Prowler: BlackHat Europe Arsenal 2018
Prowler: BlackHat Europe Arsenal 2018Prowler: BlackHat Europe Arsenal 2018
Prowler: BlackHat Europe Arsenal 2018
 
Hardening Apache Web Server by Aswin
Hardening Apache Web Server by AswinHardening Apache Web Server by Aswin
Hardening Apache Web Server by Aswin
 
Whats new in oracle orachk & exachk 18.2.0
Whats new in oracle orachk & exachk 18.2.0Whats new in oracle orachk & exachk 18.2.0
Whats new in oracle orachk & exachk 18.2.0
 
SFS (Secure File System)
SFS (Secure File System)SFS (Secure File System)
SFS (Secure File System)
 
Types of ssl commands and keytool
Types of ssl commands and keytoolTypes of ssl commands and keytool
Types of ssl commands and keytool
 
Introduction to vault
Introduction to vaultIntroduction to vault
Introduction to vault
 
Secure Keystone Deployment
Secure Keystone DeploymentSecure Keystone Deployment
Secure Keystone Deployment
 
ACME and Let's Encrypt: HTTPS made easy
ACME and Let's Encrypt: HTTPS made easyACME and Let's Encrypt: HTTPS made easy
ACME and Let's Encrypt: HTTPS made easy
 
NoSQL Exploitation Framework
NoSQL Exploitation FrameworkNoSQL Exploitation Framework
NoSQL Exploitation Framework
 
Security for devs
Security for devsSecurity for devs
Security for devs
 
Web Server Hardening
Web Server HardeningWeb Server Hardening
Web Server Hardening
 
Credential store using HashiCorp Vault
Credential store using HashiCorp VaultCredential store using HashiCorp Vault
Credential store using HashiCorp Vault
 
The Key to Strong Cloud Security
The Key to Strong Cloud SecurityThe Key to Strong Cloud Security
The Key to Strong Cloud Security
 
Apache CXF Security Solutions
Apache CXF Security SolutionsApache CXF Security Solutions
Apache CXF Security Solutions
 
Let's Encrypt!
Let's Encrypt!Let's Encrypt!
Let's Encrypt!
 
Oracle Audit vault
Oracle Audit vaultOracle Audit vault
Oracle Audit vault
 
How to Never Leave Your Deployment Unattended
How to Never Leave Your Deployment UnattendedHow to Never Leave Your Deployment Unattended
How to Never Leave Your Deployment Unattended
 
Security with VA Smalltalk
Security with VA SmalltalkSecurity with VA Smalltalk
Security with VA Smalltalk
 

Similar to SQL Server 2017 CLR

Extracting Credentials From Windows
Extracting Credentials From WindowsExtracting Credentials From Windows
Extracting Credentials From Windows
NetSPI
 
BYOP: Custom Processor Development with Apache NiFi
BYOP: Custom Processor Development with Apache NiFiBYOP: Custom Processor Development with Apache NiFi
BYOP: Custom Processor Development with Apache NiFi
DataWorks Summit
 

Similar to SQL Server 2017 CLR (20)

OUGLS 2016: Guided Tour On The MySQL Source Code
OUGLS 2016: Guided Tour On The MySQL Source CodeOUGLS 2016: Guided Tour On The MySQL Source Code
OUGLS 2016: Guided Tour On The MySQL Source Code
 
Secure360 - Extracting Password from Windows
Secure360 - Extracting Password from WindowsSecure360 - Extracting Password from Windows
Secure360 - Extracting Password from Windows
 
12.2 secure configureconsole_adop_changes_aioug_appsdba_nov17
12.2 secure configureconsole_adop_changes_aioug_appsdba_nov1712.2 secure configureconsole_adop_changes_aioug_appsdba_nov17
12.2 secure configureconsole_adop_changes_aioug_appsdba_nov17
 
Extracting Credentials From Windows
Extracting Credentials From WindowsExtracting Credentials From Windows
Extracting Credentials From Windows
 
Finding The Weak Link in Windows Binaries
Finding The Weak Link in Windows BinariesFinding The Weak Link in Windows Binaries
Finding The Weak Link in Windows Binaries
 
BYOP: Custom Processor Development with Apache NiFi
BYOP: Custom Processor Development with Apache NiFiBYOP: Custom Processor Development with Apache NiFi
BYOP: Custom Processor Development with Apache NiFi
 
Enterprise-class security with PostgreSQL - 1
Enterprise-class security with PostgreSQL - 1Enterprise-class security with PostgreSQL - 1
Enterprise-class security with PostgreSQL - 1
 
ASP.NET MVC Workshop for Women in Technology
ASP.NET MVC Workshop for Women in TechnologyASP.NET MVC Workshop for Women in Technology
ASP.NET MVC Workshop for Women in Technology
 
Kangaroot EDB Webinar Best Practices in Security with PostgreSQL
Kangaroot EDB Webinar Best Practices in Security with PostgreSQLKangaroot EDB Webinar Best Practices in Security with PostgreSQL
Kangaroot EDB Webinar Best Practices in Security with PostgreSQL
 
MySQL in oracle_environments(Part 2): MySQL Enterprise Monitor & Oracle Enter...
MySQL in oracle_environments(Part 2): MySQL Enterprise Monitor & Oracle Enter...MySQL in oracle_environments(Part 2): MySQL Enterprise Monitor & Oracle Enter...
MySQL in oracle_environments(Part 2): MySQL Enterprise Monitor & Oracle Enter...
 
Oracle plsql code refactoring - from anonymous block to stored procedure
Oracle plsql code refactoring - from anonymous block to stored procedureOracle plsql code refactoring - from anonymous block to stored procedure
Oracle plsql code refactoring - from anonymous block to stored procedure
 
ow.ppt
ow.pptow.ppt
ow.ppt
 
ow.ppt
ow.pptow.ppt
ow.ppt
 
Ow
OwOw
Ow
 
ukoug2008-oracle-activedirectory-wi-131847.ppt
ukoug2008-oracle-activedirectory-wi-131847.pptukoug2008-oracle-activedirectory-wi-131847.ppt
ukoug2008-oracle-activedirectory-wi-131847.ppt
 
Open Source License Compliance with AGL
Open Source License Compliance with AGLOpen Source License Compliance with AGL
Open Source License Compliance with AGL
 
Security of Oracle EBS - How I can Protect my System (UKOUG APPS 18 edition)
Security of Oracle EBS - How I can Protect my System (UKOUG APPS 18 edition)Security of Oracle EBS - How I can Protect my System (UKOUG APPS 18 edition)
Security of Oracle EBS - How I can Protect my System (UKOUG APPS 18 edition)
 
Tech-Spark: SQL Server on Linux
Tech-Spark: SQL Server on LinuxTech-Spark: SQL Server on Linux
Tech-Spark: SQL Server on Linux
 
Terrascan - Cloud Native Security Tool
Terrascan - Cloud Native Security Tool Terrascan - Cloud Native Security Tool
Terrascan - Cloud Native Security Tool
 
A to z for sql azure databases
A to z for sql azure databasesA to z for sql azure databases
A to z for sql azure databases
 

More from Eduardo Piairo

More from Eduardo Piairo (20)

ADDO 2021: Why and how to include database changes in the deployment pipeline
ADDO 2021: Why and how to include database changes in the deployment pipelineADDO 2021: Why and how to include database changes in the deployment pipeline
ADDO 2021: Why and how to include database changes in the deployment pipeline
 
Adding unit tests to the database deployment pipeline
Adding unit tests to the database deployment pipelineAdding unit tests to the database deployment pipeline
Adding unit tests to the database deployment pipeline
 
Start by changing the way of work
Start by changing the way of workStart by changing the way of work
Start by changing the way of work
 
Adding unit tests to the database deployment pipeline
Adding unit tests to the database deployment pipelineAdding unit tests to the database deployment pipeline
Adding unit tests to the database deployment pipeline
 
Adding unit tests with tSQLt to the database deployment pipeline
Adding unit tests with tSQLt to the database deployment pipelineAdding unit tests with tSQLt to the database deployment pipeline
Adding unit tests with tSQLt to the database deployment pipeline
 
Adding unit tests with tSQLt to the database deployment pipeline
 Adding unit tests with tSQLt to the database deployment pipeline Adding unit tests with tSQLt to the database deployment pipeline
Adding unit tests with tSQLt to the database deployment pipeline
 
Operations for databases – The DevOps journey
Operations for databases – The DevOps journey Operations for databases – The DevOps journey
Operations for databases – The DevOps journey
 
Deployment pipeline for databases
Deployment pipeline for databasesDeployment pipeline for databases
Deployment pipeline for databases
 
Deployment pipeline for databases
Deployment pipeline for databasesDeployment pipeline for databases
Deployment pipeline for databases
 
Adding unit tests with tSQLt to the database deployment pipeline
Adding unit tests with tSQLt to the database deployment pipelineAdding unit tests with tSQLt to the database deployment pipeline
Adding unit tests with tSQLt to the database deployment pipeline
 
Operations for databases: the agile/devops journey
Operations for databases: the agile/devops journeyOperations for databases: the agile/devops journey
Operations for databases: the agile/devops journey
 
Setting a WordPress website using Azure Web Apps And Azure Database for MySQL
Setting a WordPress website using Azure Web Apps And Azure Database for MySQLSetting a WordPress website using Azure Web Apps And Azure Database for MySQL
Setting a WordPress website using Azure Web Apps And Azure Database for MySQL
 
Deployment pipeline for Azure SQL Databases
Deployment pipeline for Azure SQL DatabasesDeployment pipeline for Azure SQL Databases
Deployment pipeline for Azure SQL Databases
 
Operations for databases – the agile/devops journey
Operations for databases – the agile/devops journeyOperations for databases – the agile/devops journey
Operations for databases – the agile/devops journey
 
Delivering changes for applications and databases @ Azure
Delivering changes for applications and databases @ AzureDelivering changes for applications and databases @ Azure
Delivering changes for applications and databases @ Azure
 
Delivering changes for databases and applications
Delivering changes for databases and applicationsDelivering changes for databases and applications
Delivering changes for databases and applications
 
Workshop: Delivering chnages for applications and databases
Workshop: Delivering chnages for applications and databasesWorkshop: Delivering chnages for applications and databases
Workshop: Delivering chnages for applications and databases
 
Database Source Control: Migrations vs State
Database Source Control: Migrations vs StateDatabase Source Control: Migrations vs State
Database Source Control: Migrations vs State
 
Road to database automation: database source control
Road to database automation: database source controlRoad to database automation: database source control
Road to database automation: database source control
 
Deployment Pipeline for databases (Azure SQL Database, SQL Server)
Deployment Pipeline for databases (Azure SQL Database, SQL Server)Deployment Pipeline for databases (Azure SQL Database, SQL Server)
Deployment Pipeline for databases (Azure SQL Database, SQL Server)
 

Recently uploaded

CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 

Recently uploaded (20)

Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 

SQL Server 2017 CLR