SlideShare uma empresa Scribd logo
1 de 42
Baixar para ler offline
Java Security Manager Reloaded 
Josef Cacek 
Senior Quality Engineer 
Red Hat / JBoss 
#Devoxx #jsm-reloaded @jckwart
Agenda 
● Java Security Manager 
– quickstart 
– issues 
● Reloaded 
– there is an easier way 
– pro-grade library 
#Devoxx #jsm-reloaded @jckwart
Do you run 
? 
#Devoxx #jsm-reloaded @jckwart
Do you run 
apps with Java Security Manager 
? 
#Devoxx #jsm-reloaded @jckwart
You should be affraid 
You are treatened! 
#Devoxx #jsm-reloaded @jckwart
Threats 
● bugs in libraries 
– lazy programmers 
● hidden features 
– evil programmers 
● man-in-the-middle 
– The Hackers 
#Devoxx #jsm-reloaded @jckwart
Java has a solution 
#Devoxx #jsm-reloaded @jckwart
Java Security Manager (JSM) 
checks if the caller has permissions 
to run protected actions. 
#Devoxx #jsm-reloaded @jckwart
Terminology 
Sensitive code calls extends java.lang.SecurityManager 
Security Manager 
enforces 
Policy 
Permissions 
extends java.security.Policy 
extends java.security.Permission 
#Devoxx #jsm-reloaded @jckwart
Example: Sensitive code calling JSM 
SecurityManager sm = System.getSecurityManager(); 
if (sm != null) 
sm.checkPermission( 
new org.jboss.SimplePermission("getCache")); 
#Devoxx #jsm-reloaded @jckwart
Example: Sensitive code calling JSM 
AccessControl 
SecurityManager sm = System.getSecurityManager(); 
if (sm != null) 
sm.checkPermission( 
Exception 
new org.jboss.SimplePermission("getCache")); 
#Devoxx #jsm-reloaded @jckwart
Policy 
● keeps which protected actions are allowed 
– No action by default 
● defined in policy file 
● grant entries assigns Permissions to 
– code path [codeBase] 
– signed classes [signedBy] 
– authenticated user [principal] 
#Devoxx #jsm-reloaded @jckwart
Example: Policy file 
keystore "/opt/redhat.keystore"; 
grant { 
permission java.io.FilePermission "/tmp/-", "read,write"; 
}; 
grant codeBase "file:${jboss.home.dir}/jboss-modules.jar" { 
permission java.lang.RuntimePermission "getStackTrace"; 
permission java.util.PropertyPermission "*", "read,write"; 
}; 
grant signedBy "jboss" { 
permission java.security.AllPermission; 
}; 
#Devoxx #jsm-reloaded @jckwart
Example: Policy file 
keystore "/opt/redhat.keystore"; 
grant { 
permission java.io.FilePermission "/tmp/-", "read,write"; 
}; 
grant codeBase "file:${jboss.home.dir}/jboss-modules.jar" { 
permission java.lang.RuntimePermission "getStackTrace"; 
permission java.util.PropertyPermission "*", "read,write"; 
}; 
grant signedBy "jboss" { 
permission java.security.AllPermission; 
}; 
#Devoxx #jsm-reloaded @jckwart
Example: Policy file 
keystore "/opt/redhat.keystore"; 
grant { 
permission java.io.FilePermission "/tmp/-", "read,write"; 
}; 
grant codeBase "file:${jboss.home.dir}/jboss-modules.jar" { 
permission java.lang.RuntimePermission "getStackTrace"; 
permission java.util.PropertyPermission "*", "read,write"; 
}; 
grant signedBy "jboss" { 
permission java.security.AllPermission; 
}; 
#Devoxx #jsm-reloaded @jckwart
Example: Policy file 
keystore "/opt/redhat.keystore"; 
grant { 
permission java.io.FilePermission "/tmp/-", "read,write"; 
}; 
grant codeBase "file:${jboss.home.dir}/jboss-modules.jar" { 
permission java.lang.RuntimePermission "getStackTrace"; 
permission java.util.PropertyPermission "*", "read,write"; 
}; 
grant signedBy "jboss" { 
permission java.security.AllPermission; 
}; 
#Devoxx #jsm-reloaded @jckwart
Permission 
● represents access right to a protected action 
● has a type and target 
● may have actions 
● java.lang.AllPermission 
– unrestricted access to all resources 
– automatically granted to system classes 
#Devoxx #jsm-reloaded @jckwart
Example: Read a file 
● App [app.jar] → Utils [app-lib.jar]→ FileReader(“/etc/passwd”) 
#Devoxx #jsm-reloaded @jckwart
Example: Read a file 
● App [app.jar] → Utils [app-lib.jar]→ FileReader(“/etc/passwd”) 
Exception in thread "main" java.security.AccessControlException: 
access denied ("java.io.FilePermission" "/etc/passwd" "read") 
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:372) 
at java.security.AccessController.checkPermission(AccessController.java:559) 
at java.lang.SecurityManager.checkPermission(SecurityManager.java:549) 
at java.lang.SecurityManager.checkRead(SecurityManager.java:888) 
at java.io.FileInputStream.<init>(FileInputStream.java:135) 
at java.io.FileInputStream.<init>(FileInputStream.java:101) 
at java.io.FileReader.<init>(FileReader.java:58) 
at org.jboss.shared.Utils.getUserListInternal(Utils.java:36) 
at org.jboss.shared.Utils.getUsersList(Utils.java:28) 
at org.jboss.test.App.run(App.java:35) 
at org.jboss.test.App.main(App.java:28) 
system classes 
app-lib.jar 
app.jar 
#Devoxx #jsm-reloaded @jckwart
Example: Read a file 
● App [app.jar] → Utils [app-lib.jar]→ FileReader(“/etc/passwd”) 
Exception in thread "main" java.security.AccessControlException: 
access denied ("java.io.FilePermission" "/etc/passwd" "read") 
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:372) 
at java.security.AccessController.checkPermission(AccessController.java:559) 
at java.lang.SecurityManager.checkPermission(SecurityManager.java:549) 
at java.lang.SecurityManager.checkRead(SecurityManager.java:888) 
at java.io.FileInputStream.<init>(FileInputStream.java:135) 
at java.io.FileInputStream.<init>(FileInputStream.java:101) 
at java.io.FileReader.<init>(FileReader.java:58) 
at org.jboss.shared.Utils.getUserListInternal(Utils.java:36) 
at org.jboss.shared.Utils.getUsersList(Utils.java:28) 
at org.jboss.test.App.run(App.java:35) 
at org.jboss.test.App.main(App.java:28) 
system classes 
app-lib.jar 
app.jar 
#Devoxx #jsm-reloaded @jckwart
Example: Read a file 
● App [app.jar] → Utils [app-lib.jar]→ FileReader(“/etc/passwd”) 
Exception in thread "main" java.security.AccessControlException: 
access denied ("java.io.FilePermission" "/etc/passwd" "read") 
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:372) 
at java.security.AccessController.checkPermission(AccessController.java:559) 
at java.lang.SecurityManager.checkPermission(SecurityManager.java:549) 
at java.lang.SecurityManager.checkRead(SecurityManager.java:888) 
at java.io.FileInputStream.<init>(FileInputStream.java:135) 
at java.io.FileInputStream.<init>(FileInputStream.java:101) 
at java.io.FileReader.<init>(FileReader.java:58) 
at org.jboss.shared.Utils.getUserListInternal(Utils.java:36) 
at org.jboss.shared.Utils.getUsersList(Utils.java:28) 
at org.jboss.test.App.run(App.java:35) 
at org.jboss.test.App.main(App.java:28) 
system classes 
app-lib.jar 
app.jar 
#Devoxx #jsm-reloaded @jckwart
Example: Read a file 
● App [app.jar] → Utils [app-lib.jar]→ FileReader(“/etc/passwd”) 
Exception in thread "main" java.security.AccessControlException: 
access denied ("java.io.FilePermission" "/etc/passwd" "read") 
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:372) 
at java.security.AccessController.checkPermission(AccessController.java:559) 
at java.lang.SecurityManager.checkPermission(SecurityManager.java:549) 
at java.lang.SecurityManager.checkRead(SecurityManager.java:888) 
at java.io.FileInputStream.<init>(FileInputStream.java:135) 
at java.io.FileInputStream.<init>(FileInputStream.java:101) 
at java.io.FileReader.<init>(FileReader.java:58) 
at org.jboss.shared.Utils.getUserListInternal(Utils.java:36) 
at org.jboss.shared.Utils.getUsersList(Utils.java:28) 
at org.jboss.test.App.run(App.java:35) 
at org.jboss.test.App.main(App.java:28) 
system classes 
app-lib.jar 
app.jar 
#Devoxx #jsm-reloaded @jckwart
JSM quickstart 
● set java.security.manager system property 
– no value → default implementation 
– class name → custom SecurityManager implementation 
● set java.security.policy system property 
– path to text file with permission mappings 
● set java.security.debug system property (optional) 
#Devoxx #jsm-reloaded @jckwart
Example: Run Application with JSM enabled 
java  
-Djava.security.manager  
-Djava.security.policy=/opt/jEdit/jEdit.policy  
-Djava.security.debug=access:failure  
-jar /opt/jEdit/jedit.jar /etc/passwd 
#Devoxx #jsm-reloaded @jckwart
Protect your systems 
Use Java Security Manager! 
#Devoxx #jsm-reloaded @jckwart
However ... 
#Devoxx #jsm-reloaded @jckwart
JSM issues - #1 performance 
#Devoxx #jsm-reloaded @jckwart
JSM issues - #2 policy file tooling 
#Devoxx #jsm-reloaded @jckwart
JSM Reloaded 
pro-grade library 
Set of SecurityManager 
and Policy implementations. 
#Devoxx #jsm-reloaded @jckwart
pro-grade library 
● Java Security Manager made easy(ier) 
● authors 
– Ondřej Lukáš 
– Josef Cacek 
● Apache License 
http://pro-grade.sourceforge.net/ 
#Devoxx #jsm-reloaded @jckwart
pro-grade components 
#1 policy with deny entries 
#2 policy file generator 
#3 missing permissions debugger 
#Devoxx #jsm-reloaded @jckwart
#1 pro-grade policy with deny rules 
● “subtracting” permissions from the granted ones 
● helps to decrease count of mapped permissions 
Policy Rules Of Granting And DEnying 
GRANT 
DENY 
#Devoxx #jsm-reloaded @jckwart
#1 pro-grade policy with deny rules 
● “subtracting” permissions from the granted ones 
● helps to decrease count of mapped permissions 
// grant full access to /tmp folder 
grant { 
permission java.io.FilePermission "/tmp/-", "read,write"; 
}; 
// deny write access to the static subfolder of /tmp 
deny { 
permission java.io.FilePermission "/tmp/static/-", "write"; 
}; 
#Devoxx #jsm-reloaded @jckwart
#2 pro-grade policy file generator 
● policytool on (a)steroids 
● No GUI is better than any GUI! 
● doesn't throw the 
AccessControlException 
#Devoxx #jsm-reloaded @jckwart
#3 pro-grade permissions debugger 
● prints info about missing permissions to error stream without 
stopping application 
>> Denied permission java.io.FilePermission "/etc/passwd", "read"; 
>>> CodeSource: (file:/tmp/app-lib.jar <no signer certificates>) 
#Devoxx #jsm-reloaded @jckwart
Demo 
Security policy for Java EE server 
in 3 minutes. 
#Devoxx #jsm-reloaded @jckwart
Use Java Security Manager! 
#Devoxx #jsm-reloaded @jckwart
Use Java Security Manager! 
#Devoxx #jsm-reloaded @jckwart
Use Java Security Manager! 
Make it easy with pro-grade 
#Devoxx #jsm-reloaded @jckwart
pro-grade fighting JSM issues 
● performance 
→ deny rules helps 
● policy file tooling 
→ generator – fully automated 
→ debugger – quick check what's missing 
#Devoxx #jsm-reloaded @jckwart
Thank you. Questions? 
josef.cacek@gmail.com 
@jckwart 
http://javlog.cacek.cz 
http://pro-grade.sourceforge.net 
http://github.com/pro-grade/pro-grade 
#Devoxx #jsm-reloaded @jckwart
Credits 
public domain images – pixabay.com 
public domain drawings – openclipart.org 
#Devoxx #jsm-reloaded @jckwart

Mais conteúdo relacionado

Mais procurados

Dear Hacker: Infrastructure Security Reality Check
Dear Hacker: Infrastructure Security Reality CheckDear Hacker: Infrastructure Security Reality Check
Dear Hacker: Infrastructure Security Reality CheckPaula Januszkiewicz
 
Hunting for Credentials Dumping in Windows Environment
Hunting for Credentials Dumping in Windows EnvironmentHunting for Credentials Dumping in Windows Environment
Hunting for Credentials Dumping in Windows EnvironmentTeymur Kheirkhabarov
 
Hack Proof Your Drupal Site
Hack Proof Your Drupal SiteHack Proof Your Drupal Site
Hack Proof Your Drupal SiteNaveen Valecha
 
DDD17 - Web Applications Automated Security Testing in a Continuous Delivery...
 DDD17 - Web Applications Automated Security Testing in a Continuous Delivery... DDD17 - Web Applications Automated Security Testing in a Continuous Delivery...
DDD17 - Web Applications Automated Security Testing in a Continuous Delivery...Fedir RYKHTIK
 
WordPress Security Fundamentals - WordCamp Biratnagar 2018
WordPress Security Fundamentals - WordCamp Biratnagar 2018WordPress Security Fundamentals - WordCamp Biratnagar 2018
WordPress Security Fundamentals - WordCamp Biratnagar 2018Abul Khayer
 
Adventures in Underland: Is encryption solid as a rock or a handful of dust?
Adventures in Underland: Is encryption solid as a rock or a handful of dust?Adventures in Underland: Is encryption solid as a rock or a handful of dust?
Adventures in Underland: Is encryption solid as a rock or a handful of dust?Paula Januszkiewicz
 
Security Аrchitecture of Тhe Java Platform
Security Аrchitecture of Тhe Java PlatformSecurity Аrchitecture of Тhe Java Platform
Security Аrchitecture of Тhe Java PlatformMartin Toshev
 
State of Solr Security 2016: Presented by Ishan Chattopadhyaya, Lucidworks
State of Solr Security 2016: Presented by Ishan Chattopadhyaya, LucidworksState of Solr Security 2016: Presented by Ishan Chattopadhyaya, Lucidworks
State of Solr Security 2016: Presented by Ishan Chattopadhyaya, LucidworksLucidworks
 
Apache2 BootCamp : Restricting Access
Apache2 BootCamp : Restricting AccessApache2 BootCamp : Restricting Access
Apache2 BootCamp : Restricting AccessWildan Maulana
 
Maven basics (Android & IntelliJ)
Maven basics (Android & IntelliJ)Maven basics (Android & IntelliJ)
Maven basics (Android & IntelliJ)Hussain Mansoor
 
Securing Hadoop with OSSEC
Securing Hadoop with OSSECSecuring Hadoop with OSSEC
Securing Hadoop with OSSECVic Hargrave
 
Securing Drupal 7: Do not get Hacked or Spammed to death!
Securing Drupal 7: Do not get Hacked or Spammed to death!Securing Drupal 7: Do not get Hacked or Spammed to death!
Securing Drupal 7: Do not get Hacked or Spammed to death!Adelle Frank
 
CQURE_BHAsia19_Paula_Januszkiewicz_slides
CQURE_BHAsia19_Paula_Januszkiewicz_slidesCQURE_BHAsia19_Paula_Januszkiewicz_slides
CQURE_BHAsia19_Paula_Januszkiewicz_slidesZuzannaKornecka
 
[1.2] Трюки при анализе защищенности веб приложений – продвинутая версия - С...
[1.2] Трюки при анализе защищенности веб приложений – продвинутая версия - С...[1.2] Трюки при анализе защищенности веб приложений – продвинутая версия - С...
[1.2] Трюки при анализе защищенности веб приложений – продвинутая версия - С...OWASP Russia
 
Drupal Security Basics for the DrupalJax January Meetup
Drupal Security Basics for the DrupalJax January MeetupDrupal Security Basics for the DrupalJax January Meetup
Drupal Security Basics for the DrupalJax January MeetupChris Hales
 
Secure Search - Using Apache Sentry to Add Authentication and Authorization S...
Secure Search - Using Apache Sentry to Add Authentication and Authorization S...Secure Search - Using Apache Sentry to Add Authentication and Authorization S...
Secure Search - Using Apache Sentry to Add Authentication and Authorization S...Lucidworks
 
Whatever it takes - Fixing SQLIA and XSS in the process
Whatever it takes - Fixing SQLIA and XSS in the processWhatever it takes - Fixing SQLIA and XSS in the process
Whatever it takes - Fixing SQLIA and XSS in the processguest3379bd
 
Daniel Kachakil - Android's Download Provider: Discovering and exploiting thr...
Daniel Kachakil - Android's Download Provider: Discovering and exploiting thr...Daniel Kachakil - Android's Download Provider: Discovering and exploiting thr...
Daniel Kachakil - Android's Download Provider: Discovering and exploiting thr...RootedCON
 

Mais procurados (20)

Dear Hacker: Infrastructure Security Reality Check
Dear Hacker: Infrastructure Security Reality CheckDear Hacker: Infrastructure Security Reality Check
Dear Hacker: Infrastructure Security Reality Check
 
Drupal Security Hardening
Drupal Security HardeningDrupal Security Hardening
Drupal Security Hardening
 
Hunting for Credentials Dumping in Windows Environment
Hunting for Credentials Dumping in Windows EnvironmentHunting for Credentials Dumping in Windows Environment
Hunting for Credentials Dumping in Windows Environment
 
Hack Proof Your Drupal Site
Hack Proof Your Drupal SiteHack Proof Your Drupal Site
Hack Proof Your Drupal Site
 
DDD17 - Web Applications Automated Security Testing in a Continuous Delivery...
 DDD17 - Web Applications Automated Security Testing in a Continuous Delivery... DDD17 - Web Applications Automated Security Testing in a Continuous Delivery...
DDD17 - Web Applications Automated Security Testing in a Continuous Delivery...
 
WordPress Security Fundamentals - WordCamp Biratnagar 2018
WordPress Security Fundamentals - WordCamp Biratnagar 2018WordPress Security Fundamentals - WordCamp Biratnagar 2018
WordPress Security Fundamentals - WordCamp Biratnagar 2018
 
Adventures in Underland: Is encryption solid as a rock or a handful of dust?
Adventures in Underland: Is encryption solid as a rock or a handful of dust?Adventures in Underland: Is encryption solid as a rock or a handful of dust?
Adventures in Underland: Is encryption solid as a rock or a handful of dust?
 
Security Аrchitecture of Тhe Java Platform
Security Аrchitecture of Тhe Java PlatformSecurity Аrchitecture of Тhe Java Platform
Security Аrchitecture of Тhe Java Platform
 
State of Solr Security 2016: Presented by Ishan Chattopadhyaya, Lucidworks
State of Solr Security 2016: Presented by Ishan Chattopadhyaya, LucidworksState of Solr Security 2016: Presented by Ishan Chattopadhyaya, Lucidworks
State of Solr Security 2016: Presented by Ishan Chattopadhyaya, Lucidworks
 
Apache2 BootCamp : Restricting Access
Apache2 BootCamp : Restricting AccessApache2 BootCamp : Restricting Access
Apache2 BootCamp : Restricting Access
 
Maven basics (Android & IntelliJ)
Maven basics (Android & IntelliJ)Maven basics (Android & IntelliJ)
Maven basics (Android & IntelliJ)
 
Securing Hadoop with OSSEC
Securing Hadoop with OSSECSecuring Hadoop with OSSEC
Securing Hadoop with OSSEC
 
Securing Drupal 7: Do not get Hacked or Spammed to death!
Securing Drupal 7: Do not get Hacked or Spammed to death!Securing Drupal 7: Do not get Hacked or Spammed to death!
Securing Drupal 7: Do not get Hacked or Spammed to death!
 
CQURE_BHAsia19_Paula_Januszkiewicz_slides
CQURE_BHAsia19_Paula_Januszkiewicz_slidesCQURE_BHAsia19_Paula_Januszkiewicz_slides
CQURE_BHAsia19_Paula_Januszkiewicz_slides
 
[1.2] Трюки при анализе защищенности веб приложений – продвинутая версия - С...
[1.2] Трюки при анализе защищенности веб приложений – продвинутая версия - С...[1.2] Трюки при анализе защищенности веб приложений – продвинутая версия - С...
[1.2] Трюки при анализе защищенности веб приложений – продвинутая версия - С...
 
Drupal Security Basics for the DrupalJax January Meetup
Drupal Security Basics for the DrupalJax January MeetupDrupal Security Basics for the DrupalJax January Meetup
Drupal Security Basics for the DrupalJax January Meetup
 
Secure Search - Using Apache Sentry to Add Authentication and Authorization S...
Secure Search - Using Apache Sentry to Add Authentication and Authorization S...Secure Search - Using Apache Sentry to Add Authentication and Authorization S...
Secure Search - Using Apache Sentry to Add Authentication and Authorization S...
 
A Threat Hunter Himself
A Threat Hunter HimselfA Threat Hunter Himself
A Threat Hunter Himself
 
Whatever it takes - Fixing SQLIA and XSS in the process
Whatever it takes - Fixing SQLIA and XSS in the processWhatever it takes - Fixing SQLIA and XSS in the process
Whatever it takes - Fixing SQLIA and XSS in the process
 
Daniel Kachakil - Android's Download Provider: Discovering and exploiting thr...
Daniel Kachakil - Android's Download Provider: Discovering and exploiting thr...Daniel Kachakil - Android's Download Provider: Discovering and exploiting thr...
Daniel Kachakil - Android's Download Provider: Discovering and exploiting thr...
 

Destaque

Security via Java
Security via JavaSecurity via Java
Security via JavaBahaa Zaid
 
Java security in the real world (Ryan Sciampacone)
Java security in the real world (Ryan Sciampacone)Java security in the real world (Ryan Sciampacone)
Java security in the real world (Ryan Sciampacone)Chris Bailey
 
3. planning in situational calculas
3. planning in situational calculas3. planning in situational calculas
3. planning in situational calculasAnkush Kumar
 
Rest with Java EE 6 , Security , Backbone.js
Rest with Java EE 6 , Security , Backbone.jsRest with Java EE 6 , Security , Backbone.js
Rest with Java EE 6 , Security , Backbone.jsCarol McDonald
 
Spring Security
Spring SecuritySpring Security
Spring SecurityBoy Tech
 
The Present Future of OAuth
The Present Future of OAuthThe Present Future of OAuth
The Present Future of OAuthMichael Bleigh
 
OAuth for your API - The Big Picture
OAuth for your API - The Big PictureOAuth for your API - The Big Picture
OAuth for your API - The Big PictureApigee | Google Cloud
 
OAuth - Open API Authentication
OAuth - Open API AuthenticationOAuth - Open API Authentication
OAuth - Open API Authenticationleahculver
 
An Introduction to OAuth 2
An Introduction to OAuth 2An Introduction to OAuth 2
An Introduction to OAuth 2Aaron Parecki
 
Spring Framework - Spring Security
Spring Framework - Spring SecuritySpring Framework - Spring Security
Spring Framework - Spring SecurityDzmitry Naskou
 
Election algorithms
Election algorithmsElection algorithms
Election algorithmsAnkush Kumar
 
Spring Day | Identity Management with Spring Security | Dave Syer
Spring Day | Identity Management with Spring Security | Dave SyerSpring Day | Identity Management with Spring Security | Dave Syer
Spring Day | Identity Management with Spring Security | Dave SyerJAX London
 
Introduction to soft computing
Introduction to soft computingIntroduction to soft computing
Introduction to soft computingAnkush Kumar
 

Destaque (18)

415212 415212
415212 415212415212 415212
415212 415212
 
Security via Java
Security via JavaSecurity via Java
Security via Java
 
Java security in the real world (Ryan Sciampacone)
Java security in the real world (Ryan Sciampacone)Java security in the real world (Ryan Sciampacone)
Java security in the real world (Ryan Sciampacone)
 
3. planning in situational calculas
3. planning in situational calculas3. planning in situational calculas
3. planning in situational calculas
 
Rest with Java EE 6 , Security , Backbone.js
Rest with Java EE 6 , Security , Backbone.jsRest with Java EE 6 , Security , Backbone.js
Rest with Java EE 6 , Security , Backbone.js
 
Spring Security
Spring SecuritySpring Security
Spring Security
 
The Present Future of OAuth
The Present Future of OAuthThe Present Future of OAuth
The Present Future of OAuth
 
Spring Security 3
Spring Security 3Spring Security 3
Spring Security 3
 
Spring Security
Spring SecuritySpring Security
Spring Security
 
Java security
Java securityJava security
Java security
 
OAuth for your API - The Big Picture
OAuth for your API - The Big PictureOAuth for your API - The Big Picture
OAuth for your API - The Big Picture
 
OAuth - Open API Authentication
OAuth - Open API AuthenticationOAuth - Open API Authentication
OAuth - Open API Authentication
 
An Introduction to OAuth 2
An Introduction to OAuth 2An Introduction to OAuth 2
An Introduction to OAuth 2
 
Spring Framework - Spring Security
Spring Framework - Spring SecuritySpring Framework - Spring Security
Spring Framework - Spring Security
 
Election algorithms
Election algorithmsElection algorithms
Election algorithms
 
Spring Day | Identity Management with Spring Security | Dave Syer
Spring Day | Identity Management with Spring Security | Dave SyerSpring Day | Identity Management with Spring Security | Dave Syer
Spring Day | Identity Management with Spring Security | Dave Syer
 
Java Security Framework's
Java Security Framework'sJava Security Framework's
Java Security Framework's
 
Introduction to soft computing
Introduction to soft computingIntroduction to soft computing
Introduction to soft computing
 

Semelhante a Java Security Manager Reloaded - Devoxx 2014

Automation Frame works Instruction Sheet
Automation Frame works Instruction SheetAutomation Frame works Instruction Sheet
Automation Frame works Instruction SheetvodQA
 
Tollas Ferenc - Java security
Tollas Ferenc - Java securityTollas Ferenc - Java security
Tollas Ferenc - Java securityveszpremimeetup
 
mjprof: Monadic approach for JVM profiling
mjprof: Monadic approach for JVM profilingmjprof: Monadic approach for JVM profiling
mjprof: Monadic approach for JVM profilingHaim Yadid
 
CRESTCon Asia 2018 - Config Password Encryption Gone Wrong
CRESTCon Asia 2018 - Config Password Encryption Gone WrongCRESTCon Asia 2018 - Config Password Encryption Gone Wrong
CRESTCon Asia 2018 - Config Password Encryption Gone WrongKeith Lee
 
Java secure development part 3
Java secure development   part 3Java secure development   part 3
Java secure development part 3Rafel Ivgi
 
J1 2015 "Debugging Java Apps in Containers: No Heavy Welding Gear Required"
J1 2015 "Debugging Java Apps in Containers: No Heavy Welding Gear Required"J1 2015 "Debugging Java Apps in Containers: No Heavy Welding Gear Required"
J1 2015 "Debugging Java Apps in Containers: No Heavy Welding Gear Required"Daniel Bryant
 
Chapter three Java_security.ppt
Chapter three Java_security.pptChapter three Java_security.ppt
Chapter three Java_security.pptHaymanotTadese
 
Eclipse MicroProfile: Accelerating the adoption of Java Microservices
Eclipse MicroProfile: Accelerating the adoption of Java MicroservicesEclipse MicroProfile: Accelerating the adoption of Java Microservices
Eclipse MicroProfile: Accelerating the adoption of Java MicroservicesDev_Events
 
What's New in Nuxeo Platform 7.3
What's New in Nuxeo Platform 7.3 What's New in Nuxeo Platform 7.3
What's New in Nuxeo Platform 7.3 Nuxeo
 
Road to Opscon (Pisa '15) - DevOoops
Road to Opscon (Pisa '15) - DevOoopsRoad to Opscon (Pisa '15) - DevOoops
Road to Opscon (Pisa '15) - DevOoopsGianluca Varisco
 
Gianluca Varisco - DevOoops (Increase awareness around DevOps infra security)
Gianluca Varisco - DevOoops (Increase awareness around DevOps infra security)Gianluca Varisco - DevOoops (Increase awareness around DevOps infra security)
Gianluca Varisco - DevOoops (Increase awareness around DevOps infra security)Codemotion
 
MicroProfile Devoxx.us
MicroProfile Devoxx.usMicroProfile Devoxx.us
MicroProfile Devoxx.usjclingan
 
Diagnosing Your Application on the JVM
Diagnosing Your Application on the JVMDiagnosing Your Application on the JVM
Diagnosing Your Application on the JVMStaffan Larsen
 
DevoxxFR17 - Préparez-vous à la modularité selon Java 9
DevoxxFR17 - Préparez-vous à la modularité selon Java 9DevoxxFR17 - Préparez-vous à la modularité selon Java 9
DevoxxFR17 - Préparez-vous à la modularité selon Java 9Alexis Hassler
 
Devoxx17 - Préparez-vous à la modularité selon Java 9
Devoxx17 - Préparez-vous à la modularité selon Java 9Devoxx17 - Préparez-vous à la modularité selon Java 9
Devoxx17 - Préparez-vous à la modularité selon Java 9Alexis Hassler
 

Semelhante a Java Security Manager Reloaded - Devoxx 2014 (20)

Apache Maven
Apache MavenApache Maven
Apache Maven
 
Automation Frame works Instruction Sheet
Automation Frame works Instruction SheetAutomation Frame works Instruction Sheet
Automation Frame works Instruction Sheet
 
Tollas Ferenc - Java security
Tollas Ferenc - Java securityTollas Ferenc - Java security
Tollas Ferenc - Java security
 
mjprof: Monadic approach for JVM profiling
mjprof: Monadic approach for JVM profilingmjprof: Monadic approach for JVM profiling
mjprof: Monadic approach for JVM profiling
 
Maven in Mule
Maven in MuleMaven in Mule
Maven in Mule
 
CRESTCon Asia 2018 - Config Password Encryption Gone Wrong
CRESTCon Asia 2018 - Config Password Encryption Gone WrongCRESTCon Asia 2018 - Config Password Encryption Gone Wrong
CRESTCon Asia 2018 - Config Password Encryption Gone Wrong
 
Java secure development part 3
Java secure development   part 3Java secure development   part 3
Java secure development part 3
 
J1 2015 "Debugging Java Apps in Containers: No Heavy Welding Gear Required"
J1 2015 "Debugging Java Apps in Containers: No Heavy Welding Gear Required"J1 2015 "Debugging Java Apps in Containers: No Heavy Welding Gear Required"
J1 2015 "Debugging Java Apps in Containers: No Heavy Welding Gear Required"
 
Chapter three Java_security.ppt
Chapter three Java_security.pptChapter three Java_security.ppt
Chapter three Java_security.ppt
 
Eclipse MicroProfile: Accelerating the adoption of Java Microservices
Eclipse MicroProfile: Accelerating the adoption of Java MicroservicesEclipse MicroProfile: Accelerating the adoption of Java Microservices
Eclipse MicroProfile: Accelerating the adoption of Java Microservices
 
What's New in Nuxeo Platform 7.3
What's New in Nuxeo Platform 7.3 What's New in Nuxeo Platform 7.3
What's New in Nuxeo Platform 7.3
 
Road to Opscon (Pisa '15) - DevOoops
Road to Opscon (Pisa '15) - DevOoopsRoad to Opscon (Pisa '15) - DevOoops
Road to Opscon (Pisa '15) - DevOoops
 
Gianluca Varisco - DevOoops (Increase awareness around DevOps infra security)
Gianluca Varisco - DevOoops (Increase awareness around DevOps infra security)Gianluca Varisco - DevOoops (Increase awareness around DevOps infra security)
Gianluca Varisco - DevOoops (Increase awareness around DevOps infra security)
 
MicroProfile Devoxx.us
MicroProfile Devoxx.usMicroProfile Devoxx.us
MicroProfile Devoxx.us
 
Diagnosing Your Application on the JVM
Diagnosing Your Application on the JVMDiagnosing Your Application on the JVM
Diagnosing Your Application on the JVM
 
Maven
MavenMaven
Maven
 
Maven
MavenMaven
Maven
 
GradleFX
GradleFXGradleFX
GradleFX
 
DevoxxFR17 - Préparez-vous à la modularité selon Java 9
DevoxxFR17 - Préparez-vous à la modularité selon Java 9DevoxxFR17 - Préparez-vous à la modularité selon Java 9
DevoxxFR17 - Préparez-vous à la modularité selon Java 9
 
Devoxx17 - Préparez-vous à la modularité selon Java 9
Devoxx17 - Préparez-vous à la modularité selon Java 9Devoxx17 - Préparez-vous à la modularité selon Java 9
Devoxx17 - Préparez-vous à la modularité selon Java 9
 

Último

Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
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.pdfWave PLM
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyFrank van der Linden
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
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...ICS
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 

Último (20)

Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
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
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The Ugly
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
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...
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 

Java Security Manager Reloaded - Devoxx 2014

  • 1. Java Security Manager Reloaded Josef Cacek Senior Quality Engineer Red Hat / JBoss #Devoxx #jsm-reloaded @jckwart
  • 2. Agenda ● Java Security Manager – quickstart – issues ● Reloaded – there is an easier way – pro-grade library #Devoxx #jsm-reloaded @jckwart
  • 3. Do you run ? #Devoxx #jsm-reloaded @jckwart
  • 4. Do you run apps with Java Security Manager ? #Devoxx #jsm-reloaded @jckwart
  • 5. You should be affraid You are treatened! #Devoxx #jsm-reloaded @jckwart
  • 6. Threats ● bugs in libraries – lazy programmers ● hidden features – evil programmers ● man-in-the-middle – The Hackers #Devoxx #jsm-reloaded @jckwart
  • 7. Java has a solution #Devoxx #jsm-reloaded @jckwart
  • 8. Java Security Manager (JSM) checks if the caller has permissions to run protected actions. #Devoxx #jsm-reloaded @jckwart
  • 9. Terminology Sensitive code calls extends java.lang.SecurityManager Security Manager enforces Policy Permissions extends java.security.Policy extends java.security.Permission #Devoxx #jsm-reloaded @jckwart
  • 10. Example: Sensitive code calling JSM SecurityManager sm = System.getSecurityManager(); if (sm != null) sm.checkPermission( new org.jboss.SimplePermission("getCache")); #Devoxx #jsm-reloaded @jckwart
  • 11. Example: Sensitive code calling JSM AccessControl SecurityManager sm = System.getSecurityManager(); if (sm != null) sm.checkPermission( Exception new org.jboss.SimplePermission("getCache")); #Devoxx #jsm-reloaded @jckwart
  • 12. Policy ● keeps which protected actions are allowed – No action by default ● defined in policy file ● grant entries assigns Permissions to – code path [codeBase] – signed classes [signedBy] – authenticated user [principal] #Devoxx #jsm-reloaded @jckwart
  • 13. Example: Policy file keystore "/opt/redhat.keystore"; grant { permission java.io.FilePermission "/tmp/-", "read,write"; }; grant codeBase "file:${jboss.home.dir}/jboss-modules.jar" { permission java.lang.RuntimePermission "getStackTrace"; permission java.util.PropertyPermission "*", "read,write"; }; grant signedBy "jboss" { permission java.security.AllPermission; }; #Devoxx #jsm-reloaded @jckwart
  • 14. Example: Policy file keystore "/opt/redhat.keystore"; grant { permission java.io.FilePermission "/tmp/-", "read,write"; }; grant codeBase "file:${jboss.home.dir}/jboss-modules.jar" { permission java.lang.RuntimePermission "getStackTrace"; permission java.util.PropertyPermission "*", "read,write"; }; grant signedBy "jboss" { permission java.security.AllPermission; }; #Devoxx #jsm-reloaded @jckwart
  • 15. Example: Policy file keystore "/opt/redhat.keystore"; grant { permission java.io.FilePermission "/tmp/-", "read,write"; }; grant codeBase "file:${jboss.home.dir}/jboss-modules.jar" { permission java.lang.RuntimePermission "getStackTrace"; permission java.util.PropertyPermission "*", "read,write"; }; grant signedBy "jboss" { permission java.security.AllPermission; }; #Devoxx #jsm-reloaded @jckwart
  • 16. Example: Policy file keystore "/opt/redhat.keystore"; grant { permission java.io.FilePermission "/tmp/-", "read,write"; }; grant codeBase "file:${jboss.home.dir}/jboss-modules.jar" { permission java.lang.RuntimePermission "getStackTrace"; permission java.util.PropertyPermission "*", "read,write"; }; grant signedBy "jboss" { permission java.security.AllPermission; }; #Devoxx #jsm-reloaded @jckwart
  • 17. Permission ● represents access right to a protected action ● has a type and target ● may have actions ● java.lang.AllPermission – unrestricted access to all resources – automatically granted to system classes #Devoxx #jsm-reloaded @jckwart
  • 18. Example: Read a file ● App [app.jar] → Utils [app-lib.jar]→ FileReader(“/etc/passwd”) #Devoxx #jsm-reloaded @jckwart
  • 19. Example: Read a file ● App [app.jar] → Utils [app-lib.jar]→ FileReader(“/etc/passwd”) Exception in thread "main" java.security.AccessControlException: access denied ("java.io.FilePermission" "/etc/passwd" "read") at java.security.AccessControlContext.checkPermission(AccessControlContext.java:372) at java.security.AccessController.checkPermission(AccessController.java:559) at java.lang.SecurityManager.checkPermission(SecurityManager.java:549) at java.lang.SecurityManager.checkRead(SecurityManager.java:888) at java.io.FileInputStream.<init>(FileInputStream.java:135) at java.io.FileInputStream.<init>(FileInputStream.java:101) at java.io.FileReader.<init>(FileReader.java:58) at org.jboss.shared.Utils.getUserListInternal(Utils.java:36) at org.jboss.shared.Utils.getUsersList(Utils.java:28) at org.jboss.test.App.run(App.java:35) at org.jboss.test.App.main(App.java:28) system classes app-lib.jar app.jar #Devoxx #jsm-reloaded @jckwart
  • 20. Example: Read a file ● App [app.jar] → Utils [app-lib.jar]→ FileReader(“/etc/passwd”) Exception in thread "main" java.security.AccessControlException: access denied ("java.io.FilePermission" "/etc/passwd" "read") at java.security.AccessControlContext.checkPermission(AccessControlContext.java:372) at java.security.AccessController.checkPermission(AccessController.java:559) at java.lang.SecurityManager.checkPermission(SecurityManager.java:549) at java.lang.SecurityManager.checkRead(SecurityManager.java:888) at java.io.FileInputStream.<init>(FileInputStream.java:135) at java.io.FileInputStream.<init>(FileInputStream.java:101) at java.io.FileReader.<init>(FileReader.java:58) at org.jboss.shared.Utils.getUserListInternal(Utils.java:36) at org.jboss.shared.Utils.getUsersList(Utils.java:28) at org.jboss.test.App.run(App.java:35) at org.jboss.test.App.main(App.java:28) system classes app-lib.jar app.jar #Devoxx #jsm-reloaded @jckwart
  • 21. Example: Read a file ● App [app.jar] → Utils [app-lib.jar]→ FileReader(“/etc/passwd”) Exception in thread "main" java.security.AccessControlException: access denied ("java.io.FilePermission" "/etc/passwd" "read") at java.security.AccessControlContext.checkPermission(AccessControlContext.java:372) at java.security.AccessController.checkPermission(AccessController.java:559) at java.lang.SecurityManager.checkPermission(SecurityManager.java:549) at java.lang.SecurityManager.checkRead(SecurityManager.java:888) at java.io.FileInputStream.<init>(FileInputStream.java:135) at java.io.FileInputStream.<init>(FileInputStream.java:101) at java.io.FileReader.<init>(FileReader.java:58) at org.jboss.shared.Utils.getUserListInternal(Utils.java:36) at org.jboss.shared.Utils.getUsersList(Utils.java:28) at org.jboss.test.App.run(App.java:35) at org.jboss.test.App.main(App.java:28) system classes app-lib.jar app.jar #Devoxx #jsm-reloaded @jckwart
  • 22. Example: Read a file ● App [app.jar] → Utils [app-lib.jar]→ FileReader(“/etc/passwd”) Exception in thread "main" java.security.AccessControlException: access denied ("java.io.FilePermission" "/etc/passwd" "read") at java.security.AccessControlContext.checkPermission(AccessControlContext.java:372) at java.security.AccessController.checkPermission(AccessController.java:559) at java.lang.SecurityManager.checkPermission(SecurityManager.java:549) at java.lang.SecurityManager.checkRead(SecurityManager.java:888) at java.io.FileInputStream.<init>(FileInputStream.java:135) at java.io.FileInputStream.<init>(FileInputStream.java:101) at java.io.FileReader.<init>(FileReader.java:58) at org.jboss.shared.Utils.getUserListInternal(Utils.java:36) at org.jboss.shared.Utils.getUsersList(Utils.java:28) at org.jboss.test.App.run(App.java:35) at org.jboss.test.App.main(App.java:28) system classes app-lib.jar app.jar #Devoxx #jsm-reloaded @jckwart
  • 23. JSM quickstart ● set java.security.manager system property – no value → default implementation – class name → custom SecurityManager implementation ● set java.security.policy system property – path to text file with permission mappings ● set java.security.debug system property (optional) #Devoxx #jsm-reloaded @jckwart
  • 24. Example: Run Application with JSM enabled java -Djava.security.manager -Djava.security.policy=/opt/jEdit/jEdit.policy -Djava.security.debug=access:failure -jar /opt/jEdit/jedit.jar /etc/passwd #Devoxx #jsm-reloaded @jckwart
  • 25. Protect your systems Use Java Security Manager! #Devoxx #jsm-reloaded @jckwart
  • 26. However ... #Devoxx #jsm-reloaded @jckwart
  • 27. JSM issues - #1 performance #Devoxx #jsm-reloaded @jckwart
  • 28. JSM issues - #2 policy file tooling #Devoxx #jsm-reloaded @jckwart
  • 29. JSM Reloaded pro-grade library Set of SecurityManager and Policy implementations. #Devoxx #jsm-reloaded @jckwart
  • 30. pro-grade library ● Java Security Manager made easy(ier) ● authors – Ondřej Lukáš – Josef Cacek ● Apache License http://pro-grade.sourceforge.net/ #Devoxx #jsm-reloaded @jckwart
  • 31. pro-grade components #1 policy with deny entries #2 policy file generator #3 missing permissions debugger #Devoxx #jsm-reloaded @jckwart
  • 32. #1 pro-grade policy with deny rules ● “subtracting” permissions from the granted ones ● helps to decrease count of mapped permissions Policy Rules Of Granting And DEnying GRANT DENY #Devoxx #jsm-reloaded @jckwart
  • 33. #1 pro-grade policy with deny rules ● “subtracting” permissions from the granted ones ● helps to decrease count of mapped permissions // grant full access to /tmp folder grant { permission java.io.FilePermission "/tmp/-", "read,write"; }; // deny write access to the static subfolder of /tmp deny { permission java.io.FilePermission "/tmp/static/-", "write"; }; #Devoxx #jsm-reloaded @jckwart
  • 34. #2 pro-grade policy file generator ● policytool on (a)steroids ● No GUI is better than any GUI! ● doesn't throw the AccessControlException #Devoxx #jsm-reloaded @jckwart
  • 35. #3 pro-grade permissions debugger ● prints info about missing permissions to error stream without stopping application >> Denied permission java.io.FilePermission "/etc/passwd", "read"; >>> CodeSource: (file:/tmp/app-lib.jar <no signer certificates>) #Devoxx #jsm-reloaded @jckwart
  • 36. Demo Security policy for Java EE server in 3 minutes. #Devoxx #jsm-reloaded @jckwart
  • 37. Use Java Security Manager! #Devoxx #jsm-reloaded @jckwart
  • 38. Use Java Security Manager! #Devoxx #jsm-reloaded @jckwart
  • 39. Use Java Security Manager! Make it easy with pro-grade #Devoxx #jsm-reloaded @jckwart
  • 40. pro-grade fighting JSM issues ● performance → deny rules helps ● policy file tooling → generator – fully automated → debugger – quick check what's missing #Devoxx #jsm-reloaded @jckwart
  • 41. Thank you. Questions? josef.cacek@gmail.com @jckwart http://javlog.cacek.cz http://pro-grade.sourceforge.net http://github.com/pro-grade/pro-grade #Devoxx #jsm-reloaded @jckwart
  • 42. Credits public domain images – pixabay.com public domain drawings – openclipart.org #Devoxx #jsm-reloaded @jckwart