Reliable way of getting list of Mendix outgoing IPs

0
Is there a more reliable way of getting the list of Mendix’s outgoing IPs than scrapping https://docs.mendix.com/developerportal/deploy/mendix-ip-addresses/?   An API would be lovely or a simple webpage that lists the IPs (@mendix feature request 💪).
asked
1 answers
0

Since no one is answering this I’ll answer my own question. Until Mendix comes up with a better solution for this, I’m running a bash script in a cron job that does the following (the content of newIPsToWhitelist is formatted like “allow <IP>;” and then used to update the apache config):

CURL_RESPONSE="$(curl -L --header 'Accept:  text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' \
                    --header 'Accept-Encoding gzip, deflate' \
                    --header 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' \
                    'https://docs.mendix.com/developerportal/deploy/mendix-ip-addresses')"

newIPsToWhitelist="$(printf '%s\n' "${CURL_RESPONSE}" \
        | awk -F "</*code>" '/<\/*code>.*[0-9][0-9]?[0-9]?\.[0-9][0-9]?[0-9]?\.[0-9][0-9]?[0-9]?\.[0-9][0-9]?[0-9]?/ {print}' \
        | awk '{while ( match($0,/([0-9]+\.)([0-9]+\.)([0-9]+\.)[0-9]+/) ) { print "allow "substr($0,RSTART,RLENGTH)";"; $0=substr($0,RSTART+RLENGTH) } }' )"

 

answered