100 lines
2.8 KiB
Bash
Executable file
100 lines
2.8 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
. ./test.common
|
|
|
|
test_start "NTP authentication with NTS"
|
|
|
|
check_config_h 'FEAT_NTS 1' || test_skip
|
|
certtool --help &> /dev/null || test_skip
|
|
|
|
export CLKNETSIM_START_DATE=$(date -d 'Jan 1 00:00:00 UTC 2010' +'%s')
|
|
|
|
cat > tmp/cert.cfg <<EOF
|
|
cn = "node1.net1.clk"
|
|
serial = 001
|
|
activation_date = "2010-01-01 00:00:00 UTC"
|
|
expiration_date = "2010-01-02 00:00:00 UTC"
|
|
#dns_name = "node1.net1.clk"
|
|
signing_key
|
|
encryption_key
|
|
EOF
|
|
|
|
certtool --generate-privkey --key-type=ed25519 --outfile tmp/server.key &> tmp/log.certtool
|
|
certtool --generate-self-signed --load-privkey tmp/server.key \
|
|
--template tmp/cert.cfg --outfile tmp/server.crt &>> tmp/log.certtool
|
|
|
|
max_sync_time=400
|
|
dns=1
|
|
server_conf="
|
|
ntsserverkey tmp/server.key
|
|
ntsservercert tmp/server.crt
|
|
ntsprocesses 0
|
|
ntsrotate 66
|
|
ntsdumpdir tmp
|
|
"
|
|
client_server_options="minpoll 6 maxpoll 6 nts"
|
|
client_conf="
|
|
nosystemcert
|
|
ntstrustedcerts tmp/server.crt
|
|
logdir tmp
|
|
log rawmeasurements"
|
|
|
|
run_test || test_fail
|
|
check_chronyd_exit || test_fail
|
|
check_source_selection || test_fail
|
|
check_sync || test_fail
|
|
|
|
check_file_messages "20.*123\.1.* 111 111 1111" 75 80 measurements.log || test_fail
|
|
check_file_messages "20.*123\.1.* 111 001 0000" 37 39 measurements.log || test_fail
|
|
check_file_messages " 2 1 .* 4460 " 260 300 log.packets || test_fail
|
|
check_file_messages "." 6 6 ntskeys || test_fail
|
|
rm -f tmp/measurements.log
|
|
|
|
client_conf+="
|
|
ntsrefresh 120
|
|
ntsdumpdir tmp"
|
|
|
|
run_test || test_fail
|
|
check_chronyd_exit || test_fail
|
|
check_source_selection || test_fail
|
|
check_sync || test_fail
|
|
|
|
check_file_messages "20.*123\.1.* 111 111 1111" 99 103 measurements.log || test_fail
|
|
check_file_messages "20.*123\.1.* 111 001 0000" 0 0 measurements.log || test_fail
|
|
check_file_messages " 2 1 .* 4460 " 350 390 log.packets || test_fail
|
|
check_file_messages "." 6 6 ntskeys || test_fail
|
|
check_file_messages "." 11 12 192.168.123.1.nts || test_fail
|
|
rm -f tmp/measurements.log
|
|
|
|
export CLKNETSIM_START_DATE=$(date -d 'Jan 1 00:00:00 UTC 2010 + 40000 sec' +'%s')
|
|
|
|
server_conf+="
|
|
ntsrotate 100000"
|
|
client_conf+="
|
|
ntsrefresh 39500"
|
|
|
|
run_test || test_fail
|
|
check_chronyd_exit || test_fail
|
|
check_source_selection || test_fail
|
|
check_sync || test_fail
|
|
|
|
check_file_messages "20.*123\.1.* 111 111 1111" 150 160 measurements.log || test_fail
|
|
check_file_messages "20.*123\.1.* 111 001 0000" 0 0 measurements.log || test_fail
|
|
check_file_messages " 2 1 .* 4460 " 6 10 log.packets || test_fail
|
|
check_file_messages "^9\.......e+03 2 1 .* 4460 " 6 10 log.packets || test_fail
|
|
check_file_messages "." 6 6 ntskeys || test_fail
|
|
check_file_messages "." 11 12 192.168.123.1.nts || test_fail
|
|
rm -f tmp/measurements.log
|
|
|
|
client_conf="
|
|
nosystemcert"
|
|
|
|
run_test || test_fail
|
|
check_chronyd_exit || test_fail
|
|
check_source_selection && test_fail
|
|
check_sync && test_fail
|
|
|
|
check_file_messages " 2 1 .* 123 " 0 0 log.packets || test_fail
|
|
check_file_messages " 2 1 .* 4460 " 10 20 log.packets || test_fail
|
|
|
|
test_pass
|