2 Module: Test_Authorized_Keys
3 Provides unit tests and examples for the <Authorized_Keys> lens.
6 module Test_Authorized_Keys =
8 (* Test: Authorized_Keys *)
9 test Authorized_Keys.lns get "tunnel=\"0\",no-agent-forwarding,command=\"sh /etc/netstart tun0\",permitopen=\"192.0.2.1:80\",permitopen=\"192.0.2.2:25\" ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA3RC8whKGFx+b7BMTFtnIWl6t/qyvOvnuqIrMNI9J8+1sEYv8Y/pJRh0vAe2RaSKAgB2hyzXwSJ1Fh+ooraUAJ+q7P2gg2kQF1nCFeGVjtV9m4ZrV5kZARcQMhp0Bp67tPo2TCtnthPYZS/YQG6u/6Aco1XZjPvuKujAQMGSgqNskhKBO9zfhhkAMIcKVryjKYHDfqbDUCCSNzlwFLts3nJ0Hfno6Hz+XxuBIfKOGjHfbzFyUQ7smYnzF23jFs4XhvnjmIGQJcZT4kQAsRwQubyuyDuqmQXqa+2SuQfkKTaPOlVqyuEWJdG2weIF8g3YP12czsBgNppz3jsnhEgstnQ== rpinson on rpinson\n" =
10 { "key" = "AAAAB3NzaC1yc2EAAAABIwAAAQEA3RC8whKGFx+b7BMTFtnIWl6t/qyvOvnuqIrMNI9J8+1sEYv8Y/pJRh0vAe2RaSKAgB2hyzXwSJ1Fh+ooraUAJ+q7P2gg2kQF1nCFeGVjtV9m4ZrV5kZARcQMhp0Bp67tPo2TCtnthPYZS/YQG6u/6Aco1XZjPvuKujAQMGSgqNskhKBO9zfhhkAMIcKVryjKYHDfqbDUCCSNzlwFLts3nJ0Hfno6Hz+XxuBIfKOGjHfbzFyUQ7smYnzF23jFs4XhvnjmIGQJcZT4kQAsRwQubyuyDuqmQXqa+2SuQfkKTaPOlVqyuEWJdG2weIF8g3YP12czsBgNppz3jsnhEgstnQ=="
13 { "no-agent-forwarding" }
14 { "command" = "sh /etc/netstart tun0" }
15 { "permitopen" = "192.0.2.1:80" }
16 { "permitopen" = "192.0.2.2:25" }
18 { "type" = "ssh-rsa" }
19 { "comment" = "rpinson on rpinson" } }
22 let keys = "# Example keys, one of each type
24 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDpWrKYsEsVUyuwMN4ReBN/TMGsaUWzDKDz/uQr6MlNNM95MDK/BPyJ+DiBiNMFVLpRt3gH3eCJBLJKMuUDaTNy5uym2zNgAaAIVct6M2GHI68W3iY3Ja8/MaRPbyTpMh1O74S+McpAW1SGL2YzFchYMjTnu/kOD3lxiWNiDLvdLFZu0wPOi7CYG37VXR4Thb0cC92zqnCjaP1TwfhpEYUZoowElYkoV2vG+19O6cRm/zduYcf8hmegZKB4GFUJTtZ2gZ18XJDSQd0ykK3KPt/+bKskdrtfiOwSZAmUZmd2YuAlY6+CBn1T3UBdQntueukd0z1xhd6SX7Bl8+qyqLQ3 user@example
25 ssh-dsa AAAA user@example
26 ecdsa-sha2-nistp256 AAAA user@example
27 ssh-ed25519 AAAA user@example
31 ssh-dsa AAAA user@example
34 (* Test: Authorized_Keys.lns *)
35 test Authorized_Keys.lns get keys =
36 { "#comment" = "Example keys, one of each type" }
39 "AAAAB3NzaC1yc2EAAAADAQABAAABAQDpWrKYsEsVUyuwMN4ReBN/TMGsaUWzDKDz/uQr6MlNNM95MDK/BPyJ+DiBiNMFVLpRt3gH3eCJBLJKMuUDaTNy5uym2zNgAaAIVct6M2GHI68W3iY3Ja8/MaRPbyTpMh1O74S+McpAW1SGL2YzFchYMjTnu/kOD3lxiWNiDLvdLFZu0wPOi7CYG37VXR4Thb0cC92zqnCjaP1TwfhpEYUZoowElYkoV2vG+19O6cRm/zduYcf8hmegZKB4GFUJTtZ2gZ18XJDSQd0ykK3KPt/+bKskdrtfiOwSZAmUZmd2YuAlY6+CBn1T3UBdQntueukd0z1xhd6SX7Bl8+qyqLQ3"
40 { "type" = "ssh-rsa" }
41 { "comment" = "user@example" }
44 { "type" = "ssh-dsa" }
45 { "comment" = "user@example" }
48 { "type" = "ecdsa-sha2-nistp256" }
49 { "comment" = "user@example" }
52 { "type" = "ssh-ed25519" }
53 { "comment" = "user@example" }
56 { "#comment" = "Example comments" }
58 { "type" = "ssh-dsa" }
61 { "type" = "ssh-dsa" }
62 { "comment" = "user@example" }
65 (* Variable: options *)
66 let options = "# Example options
68 no-pty ssh-ed25519 AAAA
69 no-pty,command=\"foo\" ssh-dsa AAAA
70 no-pty,command=\"foo bar\" ssh-dsa AAAA
71 no-pty,from=\"example.com,10.1.1.0/16\" ssh-dsa AAAA
72 no-pty,environment=\"LANG=en_GB.UTF8\" ssh-dsa AAAA
75 (* Test: Authorized_Keys.lns *)
76 test Authorized_Keys.lns get options =
77 { "#comment" = "Example options" }
82 { "type" = "ssh-dsa" }
88 { "type" = "ssh-ed25519" }
95 { "type" = "ssh-dsa" }
100 { "command" = "foo bar" }
102 { "type" = "ssh-dsa" }
107 { "from" = "example.com,10.1.1.0/16" }
109 { "type" = "ssh-dsa" }
114 { "environment" = "LANG=en_GB.UTF8" }
116 { "type" = "ssh-dsa" }
119 (* Test: Authorized_keys.lns
121 test Authorized_keys.lns get "command=\"echo 'Please login as the user \\\"blaauser\\\" rather than the user \\\"root\\\".';echo;sleep 10\" ssh-rsa DEADBEEF== username1\n" =
122 { "key" = "DEADBEEF=="
124 { "command" = "echo 'Please login as the user \\\"blaauser\\\" rather than the user \\\"root\\\".';echo;sleep 10" }
126 { "type" = "ssh-rsa" }
127 { "comment" = "username1" }