SlideShare une entreprise Scribd logo
1  sur  42
Télécharger pour lire hors ligne
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

Contenu connexe

Tendances

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
 

Tendances (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...
 

En vedette

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
 

En vedette (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
 

Similaire à 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
 

Similaire à 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
 

Dernier

Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...OnePlan Solutions
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commercemanigoyal112
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceBrainSell Technologies
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Cizo Technology Services
 
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
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Natan Silnitsky
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprisepreethippts
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...Technogeeks
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Mater
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 

Dernier (20)

Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commerce
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. Salesforce
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
 
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...
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprise
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 

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