| 1 | #!/bin/sh |
| 2 | |
| 3 | set -e |
| 4 | |
| 5 | cp debian/tests/rlm_python3-data/python3.mods-available \ |
| 6 | /etc/freeradius/3.0/mods-available/python3 |
| 7 | cp debian/tests/rlm_python3-data/python3.sites-available \ |
| 8 | /etc/freeradius/3.0/sites-available/python3-test |
| 9 | cp debian/tests/rlm_python3-data/ubuntu_example.py.mods-config \ |
| 10 | /etc/freeradius/3.0/mods-config/python3/ubuntu_example.py |
| 11 | |
| 12 | # enable our python3 test site |
| 13 | ln -sf /etc/freeradius/3.0/sites-available/python3-test \ |
| 14 | /etc/freeradius/3.0/sites-enabled |
| 15 | |
| 16 | # enable the python3 module |
| 17 | ln -sf /etc/freeradius/3.0/mods-available/python3 \ |
| 18 | /etc/freeradius/3.0/mods-enabled |
| 19 | |
| 20 | # restart |
| 21 | service freeradius restart |
| 22 | |
| 23 | echo "Test that \"ubuntu\" can login with any password" |
| 24 | result=0 |
| 25 | output=$(radtest ubuntu anypass$$ 127.0.0.1:1234 0 testing123) || result=$? |
| 26 | if [ ${result} -ne 0 ]; then |
| 27 | echo "Failed. Output:" |
| 28 | echo "${output}" |
| 29 | exit 1 |
| 30 | else |
| 31 | echo "${output}" | grep "Reply-Message" |
| 32 | fi |
| 33 | |
| 34 | echo "Test that any other user won't work" |
| 35 | result=0 |
| 36 | output=$(radtest otheruser$$ secret$$ 127.0.0.1:1234 0 testing123 2>&1) || result=$? |
| 37 | echo "${output}" | grep "Reply-Message" |
| 38 | if [ ${result} -eq 0 ]; then |
| 39 | echo "This shouldn't have worked..." |
| 40 | echo "Output:" |
| 41 | echo "${output}" |
| 42 | exit 1 |
| 43 | fi |