@@ -680,14 +680,29 @@ baz=1
680680}
681681
682682func TestGetCommonTemplates (t * testing.T ) {
683- t .Run ("Returns ssl.conf" , func (t * testing.T ) {
683+ t .Run ("Returns ssl.conf with defaults " , func (t * testing.T ) {
684684 g := NewWithT (t )
685685
686686 result , err := GetCommonTemplates (map [string ]interface {}{})
687687 g .Expect (err ).NotTo (HaveOccurred ())
688688 g .Expect (result ).To (HaveKey ("ssl.conf" ))
689689 g .Expect (result ["ssl.conf" ]).To (ContainSubstring ("mod_ssl" ))
690- g .Expect (result ["ssl.conf" ]).To (ContainSubstring ("SSLProtocol" ))
691- g .Expect (result ["ssl.conf" ]).To (ContainSubstring ("SSLCipherSuite" ))
690+ g .Expect (result ["ssl.conf" ]).To (ContainSubstring ("SSLCipherSuite HIGH:MEDIUM:!aNULL:!MD5:!RC4:!3DES" ))
691+ g .Expect (result ["ssl.conf" ]).To (ContainSubstring ("SSLProtocol all -SSLv2 -SSLv3 -TLSv1" ))
692+ })
693+
694+ t .Run ("SSLCipherSuite and SSLProtocol can be overridden" , func (t * testing.T ) {
695+ g := NewWithT (t )
696+
697+ result , err := GetCommonTemplates (map [string ]interface {}{
698+ "SSLCipherSuite" : "ECDHE+AESGCM:ECDHE+CHACHA20" ,
699+ "SSLProtocol" : "-all +TLSv1.3" ,
700+ })
701+ g .Expect (err ).NotTo (HaveOccurred ())
702+ g .Expect (result ).To (HaveKey ("ssl.conf" ))
703+ g .Expect (result ["ssl.conf" ]).To (ContainSubstring ("SSLCipherSuite ECDHE+AESGCM:ECDHE+CHACHA20" ))
704+ g .Expect (result ["ssl.conf" ]).To (ContainSubstring ("SSLProtocol -all +TLSv1.3" ))
705+ g .Expect (result ["ssl.conf" ]).NotTo (ContainSubstring ("HIGH:MEDIUM" ))
706+ g .Expect (result ["ssl.conf" ]).NotTo (ContainSubstring ("all -SSLv2" ))
692707 })
693708}
0 commit comments