I created the following alias and put it into my ~/.zshrc:
alias kiosk-proxy="echo \"rdr pass inet proto tcp from any to any port 80 -> 127.0.0.1 port 8080\" | sudo pfctl -ef -"
It's basically a pf rule which redirects all incoming traffic with the destination port 80 to 127.0.0.1:8080 (but what it does is not important, it's just to give you some context)
Currently, I have to manually run this at every session startup, I'd like to automate it.
It would be rather simple if it didn't need sudo rights, I'd just put kiosk-proxy in my ~/.bash_profile, I guess.
But since it needs sudo, it's gonna ask for the password and I doubt it's gonna prompt it. So... How can I execute this alias with sudo rights without asking for the password? Also, it needs to know there is such alias existing in ~/.zshrc, which may not have been loaded yet. Worse case, I can move the alias to another file.