etcd ETCD_ADVERTISE_CLIENT_URLS flag - etcd

I don't understand what the ETCD_ADVERTISE_CLIENT_URLS flag does despite reading the documentation:
https://coreos.com/etcd/docs/latest/op-guide/configuration.html
The description states:
List of this member's client URLs to advertise to the rest of the cluster. These URLs can contain domain names.
I only want a single cluster setup can I leave this flag out of my conf file?
Also if i let the default flag for :
ETCD_LISTEN_CLIENT_URLS="http://localhost:2379"
Will etcd only open the service up to the localhost? How can i ensure that any clients outside localhost don't connect to port 2379?

Both --listen-client-urls and --advertise-client-urls are (put together) optional and default to port 2379. However, if you specify the --listen-client-urls flag (irrespective of the port), then it is mandatory to specify the --advertise-client-urls flag too. If you want to use any other port, then both of these flags need to be specified.
etcd will bind to port 2379 and if it sees traffic, irrespective of whether its originating from localhost or outside, it will respond to it. If you want to prevent traffic from outside localhost, then you need to block access to the port.
Hope this helps!

Related

Can one NiFi node have multiple host names?

Problem:
Not able to allow multiple host names for one single NiFi node.
Description:
I have an internal NiFi server with internal computer name 'nifi-1'. nifi.properties has the following:
nifi.web.https.host=0.0.0.0
nifi.web.https.port=9443
This works fine when I hit "https://nifi-1:9443/nifi/" internally.
I have another dns name - "nifi-1.company.com" (both names must be supported) that is routed to the same nifi node. The nifi node rejects with the following error messages when I hit "https://nifi-1.company.com:9443/nifi/":
System Error
The request contained an invalid host header [nifi-1.company.com:9443] in the request [/nifi]. Check for request manipulation or third-party intercept.
Valid host headers are [empty] or:
127.0.0.1
127.0.0.1:9443
localhost
localhost:9443
[::1]
[::1]:9443
nifi-1
nifi-1:9443
10.0.1.82
10.0.1.82:9443
0.0.0.0
0.0.0.0:9443
Question:
How to resolve this problem? Any solutions? (Thanks!)
Another way to phrase the question is how I may add more host names into the list of "valid host headers" as the above.
This issue was pointed at in NiFi 1.5 NIFI-4761. To resolve this issue, whitelist the hostname used to access NiFi using the following parameter in the nifi.properties configuration file :
nifi.web.proxy.host = host:port
Its a comma-separated list of allowed HTTP Host header values to consider when NiFi is running securely and will be receiving requests to a different host[:port]. For example, when running in a Docker container or behind a proxy (e.g. localhost:18443, proxyhost:443). By default, this value is blank, meaning NiFi should allow only requests sent to the host[:port] that NiFi is bound to.
original answer source: how to use nifi.web.proxy.host and nifi.web.proxy.context.path?

NiFi: port to use in handlehttprequest

NiFi 1.5:
i want to use the port in HandleHTTPRequest. how to decide the port can be used in HandleHTTPRequest? is there any range of port can be used here.
i already saw the nifi configuration, but could not find the ports that can be used here.
please guide me. thanks.
Any port that the OS user running NiFi can access can be used for HandleHttpRequest, but only one can be used at a time (not a range). For example, sometimes the "NiFi user" (meaning the OS user that executed the nifi.sh command to start it) isn't allowed to use system ports (<1024) so you'd need to choose one above that number. Also you need to choose a port that is not already in use by another process.
The reason a port range is not available is because HandleHttpRequest is meant to model a well-known URL as a web service; if the ports could change, the clients would all have to try the same range.

How do I route all traffic to my EC2's ip address to a specific port?

I have a basic web application running on a port in an EC2 instance. I have also created an A record in Route53 which points a domain name that I own towards the ip address of the EC2 instance.
When I directly access ip-address:port, it works fine, but because the a record does not point towards that specific port, the website cannot be accessed through the domain name.
How do I specify a port that all requests to that ip address should be routed to?
port is referenced by protocol you are using.
if you use http you will connect to port 80. https uses 443, ftp 21, smtp 25 and there are many others (they are called default ports for service but they may use every other defined).
You are probably running application, listening on some different port (but using protocol http) and that's why you can reach it by entering http://ip-address:port
what you can do to reach it by entering only http://ip-address is to set it to listen on port 80 (you will need root privileges to do this) or set redirect from port 80 to your applications port (you can use pure port redirection using iptables or (better) reverse proxy software. It can be apache as mentioned in comment above, or nginx or haproxy or something else (you haven't specified operating system anyway - those are mainly for linux).
Hope that helps

How can I force outgoing ip for specific applications? ForceBindIp doesn't seem to work

I have a dedicated windows 2012 server with 12 dedicated IPs.
I want to be able to make connections simultaneously from two different ips that I choose.
This will be used for two different browser applications.
I have tried the following:
ForceBindIP %IP_ADDRESS% %APP_EXE%
But the IP doesn't change, the browser always displays the lowest IP from my added range.
I have also experimented with a script that removes all the ips, and then just adds one.
netsh interface ipv4 delete address "Ethernet" 104.251.111.110
netsh interface ipv4 delete address "Ethernet" 104.251.111.111
netsh interface ipv4 delete address "Ethernet" 104.251.111.112
netsh interface ipv4 delete address "Ethernet" 104.251.111.114
....
netsh interface ipv4 add address "Ethernet" 104.251.111.115 255.255.255.0
This changes the address BUT I end up having only one IP for both applications.
If the applications you intend to use doesn't support binding to interfaces/ip (true, it's uncommon), you can use SOCKS or Proxy software (which is a lot more common, especially browsers).
For instance you could install WinGate or Squid http://www.squid-cache.org (which is the one I know most).
Squid-Cache have the ability to bind to different outgoing addresses based on rules (http://www.squid-cache.org/Doc/config/tcp_outgoing_address/ ).
Basically what you need to do is:
install Squid
add ACL for loopback IP mapping, such as:
acl IP110 src 127.0.0.1/32
acl IP111 src 127.0.0.2/32
[...]
tcp_outgoing_address 104.251.111.110 IP110
tcp_outgoing_address 104.251.111.111 IP111
[...]
And the default, which is just formally needed:
tcp_outgoing_address 104.251.111.110
Each application will then need to be configured with a Proxy (or SOCKS, if you go that way), which is a configuration option most commonly available. On the proxy configuration set the corresponding local IP:
for outgoing connection using IP .111, use proxy on 127.0.0.2
for outgoing connection using IP .110, use proxy on 127.0.0.1
.. and so on.
Make sure Squid (or WinGate) bind to localhost 127.0.0.1/24, so you shouldn't have big security concerns, but if this is exposed on internet you may want to proceed to security assessment anyway.
This way if you decide to offload some application remotely, to other server, you can still manage to use the same outgoing IP(s), you just need to change squid configuration to allow external connection, which could be a big plus for scaling.
It looks like you're searching for a fix involving little rework of the browser applications. Assuming that you're using IIS to serve the applications, you should:
Using File Explorer or command line, soft-link the application configuration in another root folder for each instance of the browser application.
Using IIS, recreate the application as a site for each of the above browser application folders.
Using IIS, bind each instance of the browser application to the IP address you wish to serve it with.
Caveat: It's tempting to use the same app pool for all instances, but evaluate your hardware before! Remember that (depending on the application requirements) you create a single point of failure when using a single app pool. Create separate app pools with identical parameters to reduce this risk.

Reverse proxy smtp (EXIM)

I wonder if there is any possibility to receive and set original ip address in exim ? I have an NGINX proxy where I used "proxy_pass" and "proxy_set_header X-Forwarded-For" in order to get the REAL ip address within apache runtime, there is any posibility to do it aswell for exim ?
I need the "client" real ip address in order to check for spamlists, spf records and so on, I know that I could install exim on the proxy server and configure it with everything needed to do these checks and relay to master exim server but configuration often changes and it would be easier to maintain everything from one place.
Thank you !
Doing SRS in exim will allow you to do the header rewrites.

Resources