Tomcat 7 RemoteHostValve not working for localhost - server

I am trying to restrict access to a Tomcat 7 Server by using this valve: org.apache.catalina.valves.RemoteHostValve.
It's working fine for other hosts, but I can not access the server locally by using the localhost (http://localhost:8080).
Here is the Valve:
<Valve className="org.apache.catalina.valves.RemoteHostValve" allow="host2.xy.i|host2.xy.i|localhost"/>
Any ideas?

for this function Hostname Lookups are needet.
Did you check that you have set ?
<Connector enableLookups="true" />
If its not working with the Hostname, you could reach the same result with:
<Valve className="org.apache.catalina.valves.RemoteAddrValve"
allow="127\..*"/>
But check if you have localhost V6 IP, this example matches only ipv4

Related

Fusion Middleware Consol - hostname in URL

I try to display Fusion Middleware Consol (WebLogic 12c) in my browse according to pattern:
http://hostname.domain:port/em
The port is 7001, the name of domain is domains but I can't find hostname in config.xml file. If hostname should be the hostname of the computer it doesn't work for me. Where I find the hostname?
EDIT:
Snippet from my config.xml:
<name>domains</name>
<domain-version>12.2.1.2.0</domain-version>
(...)
<server>
<name>myAdminServerName</name>
<ssl>
<name>myAdminServerName</name>
<listen-port>7002</listen-port>
</ssl>
<machine>wls_machine_1</machine>
<listen-address>127.0.0.1</listen-address>
</server>
If I run admin console in this addres: http://127.0.0.1:7001/console it works. But if I try run Fusion Middleware Consol in this URL: http://127.0.0.1.domains:7001/em or http://127.0.0.1.domains:7002/emit doesn't work.
Greetings.
By default, weblogic listens on every available address. But if you change the listening address setting, you would find it between the <listen-address></listen-address> tags
<server>
<name>myserver</name>
<listen-port-enabled>true</listen-port-enabled>
<listen-address>localhost</listen-address>
</server>

Consume a restful service without port in Mule

I have a restful service deployed in public IP, and thus does not have a port number associated with it. I need to invoke that service, in mule and create a workflow.
I can consume a service with port number as specified below but am unable to do the same for a service which does not have a port number associated.
<http:listener-config name="HTTP_Listener_Configuration" host="localhost" port="8105" doc:name="HTTP Listener Configuration" />
<http:request-config name="HTTP_Request_Configuration" host="localhost" port="8080" basePath="/onlineexam" doc:name="HTTP Request Configuration"/>
Please help
It will always have a port. If the URL does not have one specified then it is using the default http port '80' so set the port attribute to 80.
I was also facing the issue despite adding default port 443 for my HTTPS request. Usually this issue persists when the hostname ends with .io or .org. Mine was .io
Adding this inside the <http:request > block helped:
<http:request-builder>
<http:header headerName="Host" value="hostname"/>
</http:request-builder>
This will overrirde the configuration host and port. So you would still have to mention host and port number in the request configuration which will be overridden.
For http, use port 80 and for HTTPS, use port 443

MFP Server: Specifying a particular interface on a multi-homed host

MFP 7.0.0 with IF201506081356
on WebSphere Liberty 8.5.5.5 on Linux
My idea was to modify server.xml
<httpEndpoint id="defaultHttpEndpoint"
httpPort="9080"
httpsPort="9443"
host="*" > <=== change this to a specific ipaddress
And change this JNDI entry
<jndiEntry jndiName="ibm.worklight.admin.jmx.host" value="localhost"/>
to specify the same ipaddress.
After making those changes server does not initialise correctly, it attempts to access JMX on the localhost, even though nowhere in my serverl.xml is the word "localhost"
[6/11/15 13:19:24:232 CEST] 00000040 com.worklight.common.util.jmx.LibertyRuntimeMBeanHandler I Establishing REST connection to service:
jmx:rest://localhost:9443/IBMJMXConnectorREST SSL handler=null
That attempt just repeats ad nauseum ...
Is there some cached value somewhere? Something else I need to set?
During the startup of the runtimes "localhost" is always used for the JMX connection. It is a defect, an APAR will be created.

xrdp with sesman for port redirection

I am using xrdp in Centos.
1) in /etc/xrdp/xrdp.ini I set the port to -1
[xrdp1]
name=sesman-Xvnc
lib=libvnc.so
username=ask
password=ask
ip=127.0.0.1
port=-1
This is ok. I can login with my user and password.
1) in /etc/xrdp/sesman.ini I want to redirect to port 5902
port 5902: where my vncserver is already running in Xinetd.
How would you configure the sesman.ini to connect to these port 5902?
try to config /etc/xrdp/xrdp.ini, and set port as 5902
[xrdp1]
name=sesman-Xvnc
lib=libvnc.so
username=ask
password=ask
ip=127.0.0.1
port=5902

How to specify port for PostgreSQL?

I am lost. I have localhost database (PostgreSQL) and I have to add port for connection (in app.config -- connection string). I alredy tried:
localhost:port
localhost,port
(localhost),port
(local),port
None of this work, everytime I got error "The requested name is valid, but no data of the requested type was found" thrown by System.Net.Dns.InternalGetHostByName with message "cannot open connection".
So how do you specify the port? I checked this on computer with just single instance of DB server, so port could be ommitted and then it works. But I need adding port.
Update
<add key="ConnectionString" value="Server=localhost;
Port=5434;
Database=XXXXXXX;Initial Catalog=XXXXXXXXX;
UserID=XXXXX;Password=XXXXX;Encoding=UNICODE;" />
Now it works with both "localhost" and "127.0.0.1" (direct IP).
Use a separate keyword for the port:
Server=127.0.0.1;Port=...;User Id=...;Password=...;Database=...;