Proxmox 5.2 VM SSH - firewall

Good day Team,
Trust you are doing well,
I have Loaded new Proxmox 5.2 on bare Metel. Its quite different than earlier version. However, having difficulty in configuring the SSH sessions for the VMs running inside proxmox.
Firewall is really tricky and not able to put my head around. I really require some assistance.
Proxmox 5.2-1
"Datacenter Firewall Options Enable"
"Datacenter Firewall Option Input Policy ACCEPT"
"Datacenter Firewall Option Output policy ACCEPT"
Further more
"Datacenter Firewall IPSET Admin IP subnets are listed here to allow access to the proxmox server via specific IPs. "
Datacenter Firewall Add Rule Accept "Source Admin" vmbr0
I have kept Destination emplty, no macro, no protocol, no source port, no destination port
I believe that should allow full access inside the server itself via the Listed IPs inside IPset, but that's not the case.
May I ask if someone is available here who knows how to work with this firewall?
Thanks.

I did find the solution: The file /etc/pve/firewall/cluster.fw is the one that's controlling online GUI.
Enabling and Disabling Firewall from backend works via
pve-firewall enable
pve-firewall disable
There's no way to allow all the traffic. Hence, I had to define proper set of the rules that I had to apply based on the Debien Firewall.
My Specific Question is as below:
How would you apply all traffic coming in and going out on this firewall?
How would you debug which rule is making the block of the traffic coming in or leaving server in real time?

FW is disabled by default.
Datacenter -> Firewall -> Options -> Firewall Yes/No
Nodename -> Firewall -> Options -> Firewall Yes/No
each VM -> Hardware -> Network device -> Firewall checked/unchecked
Thats not difficult at all. Better do it in GUI. You can make way more mistakes by editing firewall in shell.
If all FW settings are disabled in PMOX you should check some iptables in OS or just use tcpdump, tshark to investigate.

Related

How to disable PfSense webConfiguration on WAN

I just installed PFSense in my network and configured the pfBlockerNG and Snort package. Its all running fine, except I have noticed by webConfiguraion GUI is accessible from the internet through my public WAN address. I have tried adding a rule to disallow anything other than LAN. I tried blocking traffic from any source to 'WAN net' on 443/80, but that didn't worked as well. Essentially, I want the GUI to be assessible within my LAN network and not from anywhere else.
What am I missing? Any help really appreciated.
PS: My firewall rules are pretty standard, default installed rules and the rules added by pfBlockerNG.
Note that once you install Pfsense it adds a "Default allow LAN" to LAN interface but there is no such rule on WAN interface.
It means you can access everything from LAN, that is, you can access WAN (and so the internet) but the access from WAN is blocked. Fortunately there is no way to access GUI from WAN by default.
This configuration is pretty the same the default config you find in a home/conventional router.
I advise you to try Pfsense for a while before installing packages.

How can I create a firewall which allows me to make application based rules?

I do not trust anything, so I want to write my own firewall. I'm not satisfied with the application firewalls in Linux and Windows and the distro firewalls are not adequate for my purposes. I'm frustrated with distro firewalls, most of them like pfSense, OPN Sense, ipfire just seem to give illusion of firewall but all they do is packet filtering. I'm unable to block everything and only allow few websites with it, I have created a rule to block DNS requests, applied that rule and rebooted the firewall distro but it doesn't seem to have any effect. I either have to block everything or allow everything, both of which are undesirable. The sc*mbags seemed to have deliberately made the interface unintuitive to sell service, they claim their firewalls are free but made the interface obtuse, so that they can steal money by selling service.
I'm thinking of writing my own firewall, one of this will be an application which will run on the client system and the other would be standalone distro, both will run together to allow better management. The application on the client will create a special packet signed with the hash of the application, OS, etc and the intermediary firewall distro will check this hash and allow rules and policies to be created based on this hash. Does the TCP/IP protocol allow this?
I have searched the net for resources about network API on Linux, and there are three resources about writing my own firewall, two are questions here and one is netfilter. I don't know anything about TCP/IP protocol, so I don't know if I can use the packets made TCP/IP to achieve this or I have to creatively find a way to create a special packet.

Port Forwarding An Linux IP In Virtualbox ISSUES

Here's The Scoop,
I used SET (Social Engineering Toolkit) and made duplicite of a login page, the ip that was used was 10.0.2.15 (Mind you this is on a virtual machine Virtualbox), and when I tried to view it on another computer, it says the server is not responding.I tried to port forward but it was giveing me issues.
is there anything I can do to port forward or do something like that to make the web page connected to the IP viewable on the World Wide Web of another computer.
In other words, the IP's page is only viewable on the same computer who's ip I used to host, can you make it viewable on any computers browser by port forwarding it or something that will work like that.
Use bridging networking for the guest machine. Then, that IP address should be accessible on your network if there are no firewalls enabled.
There are several issues with directly accessing this IP from a separate computer.
First, the forwarding: the computer with the VirtualMachine must accept ip forwarding. This is easy to enable:
https://wiki.archlinux.org/index.php/Internet_sharing
Second, the routing: other computers must know who to ask when looking for 10.0.2.15. This is the hardest part. You could try adding a special route rule on the other computer, to set the host as a gateway for 10.0.2.15, but it requires you to make this on every machine that wishes to access the VM.
As Ahmed said, the easiest way is probably to use a network bridge, where the virtual machine will act as any other computer on the network, with a visible IP.

How to Add Outbound Windows Firewall Exception?

I need to open up the Windows Firewall for outbound connections for an application I'm writing.
The best answers I've been able to locate are here:
http://www.shafqatahmed.com/2008/01/controlling-win.html
http://www.vincenzo.net/isxkb/index.php?title=Adding_a_rule_to_the_Windows_firewall
The problem is that method only creates an inbound rule, and not an outbound rule. (Both the C# and InnoSetup script use the same method.) This is entirely useless for me.
The default behaviour for the Windows Firewall is to allow outbound traffic, but that doesn't guarantee that someone won't change that.
I would prefer to do this in the installer (using InnoSetup) rather than doing it in C#.
Did I miss something?
Does anyone know how to create an outbound rule?
You can use netsh if you need add some exceptions for your application.
write in command line (for XP):
netsh firewall add allowedprogram ?
write in command line (for W7):
netsh advfirewall firewall add rule ?
This difference becouse netsh firewall command is deprecated. Instead, we have to use the command netsh advfirewall firewall.
More information about using the command netsh advfirewall firewall instead of the netsh firewall command we can see in Knowledge Base there: http://go.microsoft.com/fwlink/?linkid=121488
Examples:
Adding a rule for incoming traffic without security encapsulation for messenger.exe:
netsh advfirewall firewall add rule name="allow messenger" dir=in program="c:\programfiles\messenger\msmsgs.exe" security=authnoencap action=allow
Adding a rule for outgoing traffic at the port 80:
netsh advfirewall firewall add rule name="allow80" protocol=TCP dir=out localport=80 action=block
Adding rules to inbound traffic with safety & traffic encryption for TCP through port 80:
netsh advfirewall firewall add rule name="Require Encryption for Inbound TCP/80" protocol=TCP dir=in localport=80 security=authdynenc action=allow
TechNet does: Create an Outbound Port Rule on Windows 7, Windows Vista, Windows Server 2008 or Windows Server 2008 R2
Although I assume you meant to create such rules programatically, if that's the case you might be interested in Working with Group Policy Objects Programmatically.
Finally if you're planning to do that during installation, InnoSetup should be able to merge the necessary registry keys at setup time.
The problem with netsh is that it does not work on some Windows versions (e.g. Windows Vista Basic). That is why it is better to add the exception without using netsh. This article contains sample Inno Setup code.
This is one of the many tasks that can be passed off to the Windows command-line tools. netsh does the appropriate things, but it (like everything else netsh does) is next to impossible to find. The simple version is:
netsh firewall add allowedprogram <path> <name>
For more details, run:
netsh firewall add allowedprogram ?
These can be done either in the [Run] section or by calling Exec.
Note that this is depreciated in Windows 7; if you're only targeting Vista/2008 or later, you should use netsh advfirewall firewall instead. Microsoft has an article on converting from the former the latter, but I still have to support XP, so I haven't done this.

How can I develop using a local VM server without using URLs with ports in them?

I'm setting up a linux server in a VM for my development.
Previously I've had PHP, MySQL etc etc all installed locally on my Mac. Apart from being a security risk, it's a drag to maintain and keep up to date, and there's a risk that an OS upgrade will wipe part of your setup out as the changes you make are fairly non-standard.
Having the entire server contained within a VM makes it easily upgradable and portable between machines. It means I can have the same configuration as the destination server and with shared folders even if the VM gets corrupted my work is safe on the host machine.
Previously with the local installation I was able to develop on convenient URLs like http://site.dev. I'd quite like to carry this over to the VM way of development but I'm struggling to figure out how, if it's possible at all.
Here's the problem:
In Bridged mode, the VM is part of the same network as the host. This is great but I can't choose a fixed IP address as I may be joining other networks and that address may be taken already. I'd like a consistent way of addressing my VM.
In NAT mode I can't directly address the VM without using port forwarding. I can use http://site.dev if I use the hosts file to forward that to localhost and then localhost:8080 forwards to the vm:80. The trouble is I have to access http://site.dev:8080 which is inconvenient for URL construction.
Does anyone know a way around this? I'm using ubuntu server and virtualbox.
Thanks!
The answer is to define a separate host-only network adapter and use that for host->guest communication.
You can do this by powering down the guest and adding the adapter in the VM settings. Once that's done you can boot the guest again and configure the new network interface however suits you best. I chose a fixed IP address in an unused range.

Resources