Blog about middleware/ weblogic/ websphere hidden gems, problems and solutions, security issues and hacks
Most Popular Posts
-
TL;DR Servlet - html in java JSP - java in html Details: JSP (Java Server Pages) are pages that contain Java code tha...
-
How to disable remote shutdown in Tomcat Examples: change the port number from default to different one (not recommended) chang...
02/03/2014
SOA Web Services Security Testing
Here is the link to the article:
http://ipsec.pl/web-application-security/2013/web-services-security-testing.html
16/02/2014
How to create new domain in Weblogic using gui or console mode
How to create a new domain in Weblogic?
- Configuration Wizard in either GUI/ or console ( text-mode mode)
- WLST
- Create the files manually
- Copy the domain from another project :)
1a.Using the GUI mode:
${WLS_HOME}/common/bin
./config.sh
${WLS_BIN}/common/bin/config.sh
1b. Using the console ( text-based ) mode:
${WLS_HOME}/common/bin
./config.sh -mode=console
${WLS_BIN}/common/bin/config.sh -mode=console
2. Using WLST mode
11/02/2014
What are MBeans JavaBeans and JMX
What are MBeans JavaBeans and JMX
What are MBeans?
MBeans Objects are type of JavaBean, created (mostly) with the Dependency Injection
What is inside the MBean?
MBeans represent current state/ resource of a running parts of the application, and expose the management interface containing:
- getters / setters – in order to set or get specific values on the particular items
- ability to perform more advanced operations
- provide self description mechanism
MBeans structure:
So basically MBeans can hold information like statistics, current configuration, or simply act as a key-value store.
MBeans are registeresd to the MBean Server and are used in the JMX (Java Management Extensions technology).
JMX:
JMX (Java Management Extensions) – allows co connect to the currently running JVM to monitor/ manager running applications through MBeans.JMX can communicate with the MBeans through a connector (RMI, IIOP, JMS…)that talk with the MBean Server via API. MBean Server is a bridge between the connector and MBeans.
The JMX specification defines following types of MBeans:
- Standard MBeans
- Dynamic MBeans
- Open MBeans
- Model MBeans
- MXBeans
Resources:
http://docs.jboss.org/jbossas/jboss4guide/r4/html/jbosscache.chapt.html https://blogs.oracle.com/jmxetc/entry/what_is_jmxHow to disable remote shutdown in Tomcat (secure)
How to disable remote shutdown in Tomcat
Examples:
- change the port number from default to different one (not recommended)
- change the shutdown command (partially recommended)
- change port number to -1 (recommended)
$CATALINA_HOME/conf/server.xml<Server port="8005" shutdown="SHUTDOWN">
<Server port="8005" shutdown="SHUTDOWN">
<Server port="8008" shutdown="SECRETCOMMAND">
[me@me ~]$ telnet 192.168.1.3 8005
Trying 192.168.1.3...
Connected to 192.168.1.3.
Escape character is '^]'.
SHUTDOWN
Connection closed by foreign host.
|
WARNING: StandardServer.await: Invalid command 'SHUTDOWN' received
|
EXAMPLE 2:
Change the settings in the server.xml file from:
<Server port="8005" shutdown="SHUTDOWN">To
<Server port="8001" shutdown="SHUTDOWN">From now on only SHUTDOWN command issued on port 8001 (if not used by other application) will shutdown the instance. Port 8005 will not be used by this instance.
Result:
[me@me ~]$ telnet 192.168.1.3 8005
Trying 192.168.1.3...
telnet: connect to address 192.168.1.3: Connection refused
|
EXAMPLE 3 (recommended):
Change the settings in the server.xml file from:
<Server port="8005" shutdown="SHUTDOWN">To
<Server port="-1" shutdown="SHUTDOWN">This will disable SHUTDOWN service/ command for good :)
Result:
[me@me ~]$ telnet 192.168.1.3 8005
Trying 192.168.1.3...
telnet: connect to address 192.168.1.3: Connection refused
|
AJP (Liferay/ Tomcat) no response fix
https://github.com/wheelq/AJP.Stats
Description of the issue
When using Liferay on Tomcat + Apache/nginx you might experience a small Denial Of Service from time to time. In the most cases the issue is in Tomcat's configuration, well to be more precise - in lack of the configuration ;)
When defining an AJP connector on port 8009:
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" address="10.0.1.2" URIEncoding="UTF-8">
People often miss one important setting -connectiontimeout
andkeepAlivetimeout
.
Solution
connectiontimeout
- is the number of milliseconds Connector will wait, after accepting a connection, for the request URI to be presented. If no value is defined, then the value becomes: -1 (i.e. infinite).
KeepAliveTimeout
- is the number of milliseconds Connector will wait for another AJP request before closing the connection. The default value is to use the value that has been set for the connectiontimeout attribute.
Lack of this configuration might cause the DOS (Denial Of Service) of the application itself. Once you have fixed this problem be defining the settings mentioned above you might want to monitor number of connections to your application/Liferay and see if there is a high number of connections maintained or not.
AJP.Stats
That is why I have created small, not really intelligent, very slow, but working script to make your life easier :)
ENJOY! :)
https://github.com/wheelq/AJP.Stats