Showing posts with label jboss. Show all posts
Showing posts with label jboss. Show all posts

Saturday, May 12, 2018

JBoss and LdapDomain

check this https://developer.jboss.org/thread/274715?_sscc=t


in standalone.xml you should have:

<security-domain name="LdapDomain" cache-type="default">
 <authentication>
  <login-module code="LdapExtended" flag="required">
   <module-option name="java.naming.factory.initial" value="com.sun.jndi.ldap.LdapCtxFactory"/>
   <module-option name="java.naming.provider.url" value="ldap://localhost:10389"/>
   <module-option name="java.naming.security.authentication" value="simple"/>
   <module-option name="bindDN" value="uid=admin,ou=system"/>
   <module-option name="bindCredential" value="secret"/>
   <module-option name="baseCtxDN" value="ou=People,dc=example,dc=com"/>
   <module-option name="baseFilter" value="(uid={0})"/>
   <module-option name="rolesCtxDN" value="ou=Roles,dc=example,dc=com"/>
   <module-option name="roleFilter" value="(member={1})"/>
   <module-option name="roleAttributeID" value="cn"/>
   <module-option name="searchScope" value="ONELEVEL_SCOPE"/>
   <module-option name="allowEmptyPasswords" value="true"/>
  </login-module>
 </authentication>
</security-domain>





How to secure your web.xml: http://www.javamonamour.org/2012/06/tomcat-web-application-security-in-20.html


<security-constraint>
 <web-resource-collection>
  <web-resource-name>HtmlAuth</web-resource-name>
  <description>application security constraints
  </description>
  <url-pattern>/*</url-pattern>
  <http-method>GET</http-method>
  <http-method>POST</http-method>
  <http-method>PUT</http-method>
  <http-method>DELETE</http-method>
 </web-resource-collection>
 <auth-constraint>
  <role-name>Manager</role-name>
 </auth-constraint>
</security-constraint>
<login-config>
 <auth-method>BASIC</auth-method>
 <realm-name>Sample Realm</realm-name>
</login-config>
<security-role>
 <role-name>Manager</role-name>
</security-role>

jboss-web.xml :


<jboss-web>
<security-domain>java:/jaas/LdapDomain</security-domain>
</jboss-web>


In order to use FORM login, instead of BASIC:

<login-config>
    <auth-method>FORM</auth-method>
    <realm-name>OsbReports Application</realm-name>
    <form-login-config>
      <form-login-page>/login.jsp</form-login-page>
      <form-error-page>/error.jsp</form-error-page>
    </form-login-config>
  </login-config>

with login.jsp :

<form method="POST" action="j_security_check">
<input type="text" name="j_username">
<input type="password" name="j_password">
</form>


See also




https://access.redhat.com/documentation/en-us/red_hat_jboss_enterprise_application_platform/7.1/html/how_to_configure_identity_management/legacy_security_subsystem#configure_a_security_domain_to_use_ldap

https://access.redhat.com/documentation/en-us/red_hat_jboss_enterprise_application_platform/7.0/html-single/login_module_reference/index#ldapextended_login_module




All JBoss login modules: https://access.redhat.com/documentation/en-us/red_hat_jboss_enterprise_application_platform/7.1/html-single/login_module_reference/

JBOSS LDAP Examples https://developer.jboss.org/wiki/LDAPSecurityRealmExamples , shows how to use username-filter and advanced-filter to query onsAMAccountName and memberOf )





Sunday, April 22, 2018

wildfly configuration, deployment and administration - second edition


This is a decent book, hands on and very practical. It wastes a bit too much time explaining stuff that everybody knows (what is TLS) rather than concentrating only on Wildfly stuff. Also big drawback is lack of github repository with examples (you can download then from the publisher). Also the style is a bit dry and boring.

Good for the beginner just getting started with Wildfly.



Friday, April 20, 2018

jboss-cli

https://docs.jboss.org/author/display/WFLY/Command+Line+Interface

$ ./jboss-cli.sh



Unable to read the logging configuration from 'file:/d/apps/wildfly12/bin/jboss-cli-logging.properties' (java.io.FileNotFoundException: \d\apps\wildfly12\bin\jboss-cli-logging.properties (The system cannot find the path specified))
INFO  [org.jboss.modules] JBoss Modules version 1.7.0.Final
INFO  [org.jboss.as.cli.CommandContext] You are disconnected at the moment. Type 'connect' to connect to the server or 'help' for the list of supported commands.
You are disconnected at the moment. Type 'connect' to connect to the server or 'help' for the list of supported commands.
[disconnected /] connect
connect
INFO  [org.xnio] XNIO version 3.6.2.Final
INFO  [org.xnio.nio] XNIO NIO Implementation Version 3.6.2.Final
INFO  [org.jboss.remoting] JBoss Remoting version 5.0.5.Final
INFO  [org.jboss.threads] JBoss Threads version 2.3.1.Final
INFO  [org.wildfly.security] ELY00001: WildFly Elytron version 1.2.2.Final
ERROR [org.jboss.as.cli.CommandContext] The controller is not available at localhost:9990: java.net.ConnectException: WFLYPRT0053: Could not connect to remote+http://localhost:9990. The connection failed: WFLYPRT0053: Could not connect to remote+http://localhost:9990. The connection failed: Connection refused: no further information
The controller is not available at localhost:9990: java.net.ConnectException: WFLYPRT0053: Could not connect to remote+http://localhost:9990. The connection failed: WFLYPRT0053: Could not connect to remote+http://localhost:9990. The connection failed: Connection refused: no further information



Instead of the normal ports 8080/9990 I have 8180/10090 , because in standalone.xml I have specified in socket-binding-group a jboss.socket.binding.port-offset:100

So I try with

./jboss-cli.sh --controller=localhost:10090

and I get a beautiful

INFO  [org.xnio] XNIO version 3.6.2.Final
INFO  [org.xnio.nio] XNIO NIO Implementation Version 3.6.2.Final
INFO  [org.jboss.remoting] JBoss Remoting version 5.0.5.Final
INFO  [org.jboss.threads] JBoss Threads version 2.3.1.Final
INFO  [org.wildfly.security] ELY00001: WildFly Elytron version 1.2.2.Final
[standalone@localhost:10090 /]



If you look in jboss-cli.xml you see that the default controller is configured in it:

<!-- The default controller to connect to when 'connect' command is executed w/o arguments -->
    <default-controller>
        <protocol>remote+http</protocol>
        <host>localhost</host>
        <port>9990</port>
    </default-controller>

If I change 9990 to 10090, I can seamlessly connect without having to specify the --controller=localhost:10090

Remarkable also the .jbossclirc file. "# WildFly (JBoss) CLI will execute commands from this file before
# the command line session (interactive or not) will start."


Regarding the message "Unable to read the logging configuration from 'file:/d/apps/wildfly12/bin/jboss-cli-logging.properties' ", I have it only when running the jboss-cli.sh in git bash.... if I run jboss-cli.bat I don't have the problem. Most likely it's due to the fact that in git bash the $JBOSS_HOME is rendered as file:/d/apps/wildfly12/ , and Java can't handle this... welcome to the messy world of Windows...


It seems also that the TAB autocomplete is not working under git bash.... I am switching permanently to a DOS console.... how sad..



Useful CLI:

#dump elytron configuration
/subsystem=elytron:read-resource(recursive=true)

#dump logger configuration
/subsystem=logging/console-handler=CONSOLE:read-resource

#add a filesystem-realm and add a user
#see https://docs.jboss.org/author/display/WFLY/WildFly+Elytron+Security#WildFlyElytronSecurity-ConfigureAuthenticationwithaFilesystemBasedIdentityStore

/subsystem=elytron/filesystem-realm=exampleFsRealm:add(path=fs-realm-users,relative-to=jboss.server.config.dir)
/subsystem=elytron/filesystem-realm=exampleFsRealm/:add-identity(identity=user1)
cd subsystem=elytron
cd filesystem-realm=exampleFsRealm
:set-password(identity=user1,clear={password="password123"})

#(this creates a file user1-OVZWK4RR.xml with inside 'identity xmlns="urn:elytron:1.0"' )




PRICELESS: ./jboss-cli.sh --gui opens a UI which really simplifies the discovery of CLI syntax

PRICELESS: https://wildscribe.github.io/WildFly/12.0/index.html Wildfly Reference model, all attributes and operations explained (very briefly, but better than nothing)







Saturday, September 23, 2017

Cool Tools (from JBoss Hacks)



be aware that the Kindle edition is royally scr...wed up, missing ALL the sample script in the text... what a pity... maybe the PDF version available here http://www.itbuzzpress.com/ebooks/jboss-org-hacks.html is better, no idea.

https://github.com/mgm3746/garbagecat to analyze gc logs

http://fastthread.io/index.jsp thread dump analysis

https://github.com/rparree/jboss-bash-completion jboss/wildfly bash completion

http://hawt.io/ web console rich of managing plugins

http://byteman.jboss.org/index.html byteman , bytecode manipulation tool

https://hub.docker.com/r/jboss/wildfly/ dockerhub wildfly image

https://developers.redhat.com/jboss-docker/?referrer=jbd docker jboss images

https://docs.jboss.org/wildfly/plugins/maven/latest/ wildfly maven plugin


Jboss Forge
examples available here https://github.com/fmarchioni/jbosshacks

Wildfly Swarm Project Generator http://wildfly-swarm.io/generator/


https://developers.redhat.com/products/rhamt/download/ windup / migration tool to migrate from other AS to JBoss



Friday, September 22, 2017

JBoss CLI sucks

Frankly the CLI hurts the eyes... someone should make it a bit more groovish... oh in fact here there is a guide how to do it http://www.mastertheboss.com/jboss-server/jboss-script/managing-wildfly-with-groovy-shell but it's a bit raw...

some recipes here:

https://docs.jboss.org/author/display/AS71/CLI+Recipes

at the end of the book "WildFly Configuration, Deployment, and Administration - Second Edition" there is also a useful CLI cheat sheet.



Monday, August 28, 2017

Wildfly quickstarts

Wildfly Example galore here: https://github.com/wildfly/quickstart

JBOss EAP example galore here https://github.com/jboss-developer/jboss-eap-quickstarts

Latest Wildfly documentation https://docs.jboss.org/author/display/WFLY/Documentation. Wildfly can be downloaded here http://wildfly.org/downloads/



Excellent book here



with associated code https://github.com/packt-wildfly/packt-java-ee-7-code-samples

This book can be useful: Advanced Java EE Development with WildFly



For Eclipse Oxygen, you might want to install (EClipse Marketplace) the JBoss Tools https://tools.jboss.org/

https://developer.jboss.org/wiki/MavenRepository

Interesting book Wildfly cookbook https://www.packtpub.com/networking-and-servers/wildfly-cookbook





Saturday, June 10, 2017

Jboss EAP and Wildfly tutorials

I need to take an interview covering also JBoss....
https://en.wikipedia.org/wiki/JBoss_Enterprise_Application_Platform

https://en.wikipedia.org/wiki/WildFly

http://undertow.io/

https://en.wikipedia.org/wiki/OpenShift

Excellent extensive tutorial on all aspects of JBoss:
https://www.youtube.com/watch?v=KUXdQd_14fU&list=PL09NkvEHuNCdEEkCwUSlTA9UKlR4jo8rc

Wildfly presentation


Developing Java EE applications with JBoss
https://github.com/javaee-samples/javaee7-samples


Tuesday, March 22, 2011

JBoss and WebSphere MQ

Let's see if this is easier than with WebLogic

http://www.ibm.com/developerworks/websphere/library/techarticles/0710_ritchie/0710_ritchie.html


- you need the file wmq.jmsra.rar, which is in C:\Program Files\IBM\WebSphere MQ\java\lib\jca
(of course you mush install WebSphere MQ to get it :o) )


- copy wmq.jmsra.rar to /server/default/deploy


- create wmq.jmsra-ds.xml in C:\Post\app-rep\itl-v000100-ld-node1\deploy
copy it from here create the wmq.jmsra-ds.xml in

- and copy also wmq.jmsra.ivt.ear to the same folder.

- open http://localhost:8080/WMQ_IVT/


(still having trouble making it work....in the meantime I am posting this)

Monday, March 14, 2011

com.arjuna.ats.internal.jta.transaction.arjunacore.inactive

Arjuna is the JBoss transaction manager

http://management-platform.blogspot.com/2008/11/transaction-timeouts-and-ejb3jpa.html


the entire stacktrace is:

11:13:43,774 WARN [arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.BasicActio
n_58] - Abort of action id a647bde:4e9:4d7de8ef:30 invoked while multiple threads active within it.
11:13:43,790 WARN [arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.CheckedAct
ion_2] - CheckedAction::check - atomic action a647bde:4e9:4d7de8ef:30 aborting with 1 threads active!
11:13:44,274 WARN [arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.BasicActio
n_40] - Abort called on already aborted atomic action a647bde:4e9:4d7de8ef:30
11:13:44,337 FATAL [TechnicalExceptionHandler] Technical exception [7b2b91d6-ab3
f-4cb6-9bc1-3ae8302d44c5] occured:
java.lang.IllegalStateException: [com.arjuna.ats.internal.jta.transaction.arjuna
core.inactive] [com.arjuna.ats.internal.jta.transaction.arjunacore.inactive] The
transaction is not active!

at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.c
ommitAndDisassociate(TransactionImple.java:1379)
at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.co
mmit(BaseTransaction.java:135)
at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTra
nsactionManagerDelegate.java:87)
at org.jboss.aspects.tx.TxPolicy.endTransaction(TxPolicy.java:175)
at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:87)
at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java
:191)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInt
erceptor.java:95)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(Stateles
sInstanceInterceptor.java:62)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.aspects.security.AuthenticationInterceptor.invoke(Authentic
ationInterceptor.java:77)
at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3Auth
enticationInterceptor.java:110)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterce
ptor.java:46)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(Asynchrono
usInterceptor.java:106)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessCont
ainer.java:240)
at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessCont
ainer.java:210)
at org.jboss.ejb3.stateless.StatelessLocalProxy.invoke(StatelessLocalPro
xy.java:84)

Wednesday, March 9, 2011

ejbLink: duplicated

this funny error was occurring only because in the tmp directory of JBoss there were some old jars....probably because I have deployed a Web Application in the unpacked format

As with WebLogic, the same rule applies to JBoss: when you see something weird, just empty cache and tmp directories



10:38:04,677 WARN [ServiceController] Problem starting service jboss.j2ee:ear=acme-web.ear,jar=acme-domain.jar,name=BlaRepositoryBean,service=EJB3
java.lang.RuntimeException: could not resolve global JNDI name for @EJB for container BlaRepositoryBean: reference class: acme.domain.repository.VelocityProcessor ejbLink: duplicated in acme-domain.jar
at org.jboss.injection.EjbEncInjector.inject(EjbEncInjector.java:88)
at org.jboss.ejb3.EJBContainer.start(EJBContainer.java:566)
at org.jboss.ejb3.SessionContainer.start(SessionContainer.java:154)
at org.jboss.ejb3.stateless.StatelessContainer.start(StatelessContainer.
java:102)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)