Search found 2 matches

by tentacul
Sun Mar 14, 2021 11:02 pm
Forum: member support & tech assistance
Topic: Possible Race Condition in session_up.sh
Replies: 0
Views: 13721

Possible Race Condition in session_up.sh

https://cryptostorm.is/conf/session_up.sh.txt

Code: Select all

 # randomly grab an unused IP from the 10.whatever subnet specific to that instance.
        found_one=0
        while [ "$found_one" -eq "0" ]; do
         # randomly generate the last octet, in the range of 3-254 for each. only last octet cause doin c-class on this box
         RANDIP=$POOL.`echo $[ 3 + $[ RANDOM % 251 ]]`
         # not taken yet?
         if [ ! -r $instance_pool_dir/$RANDIP ]; then
          # take it
          touch $instance_pool_dir/$RANDIP
          # write out the ifconfig line to $1 which is picked up by openvpn
          echo "ifconfig-push $RANDIP 255.255.255.0" > $1
          found_one=1
         fi
        done
You should possibly use flock between "if [ ! -r $instance_pool_dir/$RANDIP ]; then" and "touch $instance_pool_dir/$RANDIP"
or multiple clients could get assigned the same IP
by tentacul
Sun Mar 14, 2021 10:56 pm
Forum: member support & tech assistance
Topic: forum.onion login fails
Replies: 1
Views: 13723

forum.onion login fails

"The submitted form was invalid. Try submitting again."