Set custom port tcp, just to login cms - tcp

I want to set custom port tcp to login cms for example wordpress.
¿This is possible?
(but set normal port 80 to entire site)
For example in cpanel whm, there have different ports 2086 not ssl and 2087 ssl
With tool like ipset (iptables in linux) can I block entire contry according to range ip and port, for example can I just allow my country to request specified port.
Another better method is use layer 2 firewall like google compute engine and block ranges of ips relation to specified port.
Sorry for this question maybe is not good.
Again:
¿Can I do this in a cms like wordpress?
Note: I know about Deny all in .htaccess.
I know about set just ssl to wp-admin.
I know i can change to rute wp-admin another alias name.

You can develop a simple bash script to download ip addresses for a particular country (represented as a zone) from ipdeny.com. The bash command would be something like:
wget -qNP [dir] http://www.ipdeny.com/ipblocks/data/countries/XX.zone
Where [dir] is the directory you wish to store the zone file containing the list of ip addresses for the country; and XX is the two character country zone code.
You can then read the ip addresses into an ipset using the strategy described at:https://www.hueyise.com/index.php/linux-dynamic-ip-address-blocking... however, this strategy applies specifically to dynamically blocking malicious ip addresses (e.g., hackers) that are discovered during operations and blocking them immediately.
I successfully implement a tailored version of this strategy to automatically download ip addresses for certain countries once per day, and then read the ip addresses into an ipset defined for blocking inbound/outbound accesses by these countries.

Related

Why does the user's IP is a local one when accessing the page using the global URL?

I am logging every user's IP when they access the company's page.
There are two ways to access the page from inside the local network:
http://company/webpage
and
https://webpage.company.com
What bugs me is that even when the users use the https global IP, their accesses are still recorded on database with their IP as 10.50.1.12 or 10.50.1.100.
Does that means that the browser or something else is redirecting the https://webpage.company.com to company/webpage? Or does that mean that I'm using a flawed method to log the users IP?
Another way to ask my question (just to make sure I'm being clear): if I'm accessing my Internet web page from inside the LAN network, am I effectively going outside my network and then back? If not, where am I going wrong with my logging?
Code used to log user's IP:
user.LastIP = HttpContext.Current.Request.UserHostAddress;
I'm curious about this because I want to make sure the users inside the company will access the page using exclusively the LAN Network. The goal is to save bandwidth usage, which is scarce.
Edit:
Pinging the https://webpage.company.com from inside the LAN network will result in a reply from a global IP address like 194.xxx.xxx.xxx. So I'm clearly getting the user's IP wrongly. What would be the ideal way of retrieving the IP from the page accessing entity?
Access to http://company/webpage will result in a DNS lookup of the host name "company". To resolve this, DNS will need a fully qualified domain name (fqdn), so it will add a top level domain (according to the configured search list in the client). In this example, it seems fair to assume that the fqdn will be "company.com". This, in turn, may very well resolve to the same IP address as the "webpage.company.com". You can check this by using dns lookup utilities like 'nslookup' and 'dig', or simply by using 'ping company' and 'ping webpage.company.com'.
The users IP addresses you mention, 10.50.1.12 and 10.50.1.100, seems to be the local IP addresses of the client hosts. I base this assumption on the fact that these IP addresses come from the RFC-1918 address range which is used for internal addresses. My guess is that these are the correct IP addresses, and that your logging works fine.
The users IP address you will log from accessing 'http://company/webpage' and 'https://webpage.company.com' should in most cases be the same. You can see it this way: it doesn't matter what the target URL is, traffic is still coming from the same host, the same IP address.
In any case, you most probably don't need to worry about any traffic leaving your local network.

Will the IP address of the Google API host ever change?

We would like to use the Google Translate API from a host which doesn't have open access to the Internet. To setup the firewall rules I would need the list of possible IP addresses for www.googleapis.com. It is resolved to different IP addresses depending on the location. It seems to be difficult to create a future proof firewall rule.
Do you know how could I get the list of IP addresses or network ranges for the Google API servers?
The IP addresses used for any given googleapis.com server could change. Google doesn't have just one network block which they host all of their content out of, they have a bunch of them - and they change over time.
There are several ways you could setup your restricted network to allow access to *.googleapis.com without hard-coding IP addresses. I don't know anything about your setup, but I've found that using an internal proxy is often the best bet when you want to allow/restrict access to a domain.

Access website over local network from other devices?

I have a website that I'm running locally at localhost:8000. I'd like to access my site from other devices on my network. I've tried to visit the site via my computer's internal IP address via: 127.0.0.1:8000but this doesn't work. Is this possible?
Three most probable things:
Check if there is a network route between the client and the server machine (commands like PING and TRACERT will help);
Check if the server machine has a firewall. If it does, there must be a rule allowing (opening) connections through that port (8000) in TCP;
Most likely, the problem is one of the two above. If not, there's one last thing:
Make sure the web server (the one that serves localhost:8000) is bound to listen to all IP addresses (not only 127.0.0.1).
To know that, search for servername bind all ip addresses on google. E.g., for apache HTTPD, it'd be apache bind all ip addresses.
here is what I do in similar cases:
search rejetto hfs on google, it is single executable less than 1Mb size and download it into your server machine.
after starting it, follow menu->IP addresses. these are all your possible addresess on the server side.
these are your IP addresses to enter, and your port is 8000 as you mentioned.
most possible IP addresses you will find are in the format of following:
192.168.?.?
10.0.0.?
169.254.?.?
besided you will probably need to add a firewall rule for your server app.

static and dynamic host configuration approaches?

I'm currently revising for an exam and I'm stuck on a question which is:
"Explain the static and dynamic host configuration approaches."
I'm unsure if the answer is correct but what I've write is this:
static host configuration are hard-coded addresses that will only work on one specific network segment, which is intended for stationary computers
dynamic host configurations work best with portable computers like laptops that move between network segments.
that's my answer, could anyone help me to understand if this is correct or not?
You are correct about the difference. But there s a lot more than what you have stated.
DHC : Used to configure IP addresses automatically to the systems without any intervention of network administrator.
For Eg. When you register for a new internet connection, your ISP(network administrator, in this case) will provide you access to the DHCP server which ll allot you the IP address on the runtime.
To prevent the same IP address being assigned to two different computers
Also the main use is, ISP s will have a range of IP addresses with them. You ll be assigned any of their IPs dynamically by DHCP Server when your lease time expires for a particular IP that have been assigned earlier
SHC : Used to manually configure the IP addresses to systems.
When you knew how many systems are going to be present exactly inside the network
And when you want to uniquely identify a system in the ntwk using its IP address
For Eg. When you configure LAN in your house, between, say, around 4 computers. You will know exactly the number of systems in the group. So you don't have to allot a DHCP Server to allot the IP addresses for these 4 systems. YOu manually configure them
Hope that helps :)

how to specify different IP addresses for different users in Tsung

is it possible to specify users IP addresses in Tsung?
Because in Apache logs, the users have the same IP address, the IP of the machine from which testing have been done. I want to specify somehow in Tsung, that it should generate new users with unique identifiers for being possible to distinguish them on Apache logs.
Some ideas?
vhost is only supported by jabber/XMPP plugin not by HTTP or others. Visit http://tsung.erlang-projects.org/user_manual.html#htoc58 to get more.
If you want to specify IP , maybe use more slave in your cluster ? But we can not specify IP per user .

Resources