martes, 29 de abril de 2025

Port forwarding on linux

To forward traffic received on port 27017 from server to 10.10.10.10, you'll need to set up the following iptables rules on the server:
# Enable IP forwarding in the kernel
sudo sysctl -w net.ipv4.ip_forward=1

# Make IP forwarding persistent across reboots
echo "net.ipv4.ip_forward=1" | sudo tee -a /etc/sysctl.conf

# Add the PREROUTING rule to redirect incoming traffic
sudo iptables -t nat -A PREROUTING -p tcp --dport 27017 -j DNAT --to-destination 10.10.10.10:27017

# Add the POSTROUTING rule for masquerading (if the destination is on a different network)
sudo iptables -t nat -A POSTROUTING -j MASQUERADE

# Allow forwarded traffic in the FORWARD chain
sudo iptables -A FORWARD -p tcp -d 10.10.10.10 --dport 27017 -j ACCEPT 
To make these rules persistent across reboots, save them with:
# For Debian/Ubuntu systems
sudo apt-get install iptables-persistent
sudo netfilter-persistent save

# OR for other distributions
sudo service iptables save

 

 

sábado, 19 de abril de 2025

Get all processor groups including sub-processor groups in nifi using rest api

 

nifi-api/flow/process-groups/root/status?recursive=true

 

This end point will return the process groups

Deactivate current venv python and run last one

# Deactivate current venv
deactivate

# Create new venv with Python 3.6+
python3.6 -m venv .venv  # or python3.7, python3.8, etc.

# Activate the new venv
source .venv/bin/activate

# Install dependencies
pip install -r requirements.txt
 
 

sudo apt install python3-pip python3-venv

pip3 --version

python3 -m venv .venv

source .venv/bin/activate