Skip to content

Instantly share code, notes, and snippets.

@coconut49
Forked from shankerwangmiao/ipsec-gen
Created January 11, 2017 15:12
Show Gist options
  • Save coconut49/c2bd6534b552121c8ac2231fec04572d to your computer and use it in GitHub Desktop.
Save coconut49/c2bd6534b552121c8ac2231fec04572d to your computer and use it in GitHub Desktop.
#!/bin/bash
function gen {
dd if=/dev/urandom bs=1 count=10000 2>/dev/null | tr -dc a-f0-9 | fold -w $1 | sed 's/^/0x/' | head -n 1
}
spi=`gen 8`
reqid=`gen 8`
auth_key=`gen 64`
enc_key=`gen 64`
cat << EOF
ENDPOINT=$1
SPI=$spi
REQID=$reqid
AUTH_KEY=$auth_key
ENC_KEY=$enc_key
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment