This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
You can setup a tunnel over SSH with -w option as below. | |
Try it at home, not server! | |
Server side | |
=========== | |
ip tuntap add mode tun dev tun0 | |
ip addr add 192.168.16.1/30 dev tun0 | |
ip link set tun0 up | |
iptables -I FORWARD -o tun0 -i <public-interface> -j ACCEPT | |
iptables -I FORWARD -i tun0 -o <public-interface> -j ACCEPT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This snippet is an example of how we can forward port 80 and 443 from a local server to a remote server | |
# These commands are working on Debian and Ubuntu | |
echo net.ipv4.ip_forward=1 > /etc/sysctl.d/99-ipforward.conf | |
sysctl -p | |
apt install iptables-persistent | |
iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to-destination <remote-server-ip>:80 | |
iptables -t nat -A PREROUTING -p tcp --dport 443 -j DNAT --to-destination <remote-server-ip>:443 | |
iptables -t nat -A POSTROUTING -j MASQUERADE | |
iptables-save > /etc/iptables/rules.v4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rpm_list="" | |
package_list="" | |
for id in $(yum --noplugins history list all 2> /dev/null | grep -v System | sed 's/^ *//;s/ *| */|/g' | grep -E "^[0-9]+\|" | awk -F '|' '$4 == "Install" || $4 ~ /I/' | cut -d '|' -f1); do | |
result=$(yum --noplugins history info $id 2> /dev/null | awk '/Packages Altered/{flag=1; next} flag' | awk '$1 == "Install"' | awk '{print $2}') | |
if [ -n "$result" ]; then | |
rpm_list+="$result"$'\n' | |
fi | |
done |