2 # Show SMTP authentication related paramters
4 require './postfix-lib.pl';
6 $access{'sasl'} || &error($text{'sasl_ecannot'});
7 &ui_print_header(undef, $text{'sasl_title'}, "");
9 $default = $text{'opts_default'};
10 $none = $text{'opts_none'};
11 $no_ = $text{'opts_no'};
14 print &ui_form_start("save_sasl.cgi");
15 print &ui_table_start($text{'sasl_title'}, "width=100%", 4);
17 # Enabled, accept broken clients
18 &option_yesno("smtpd_sasl_auth_enable");
19 &option_yesno("broken_sasl_auth_clients");
21 # Anonymous and plain-text options
23 split(/[\s,]+/, &get_current_value("smtpd_sasl_security_options"));
25 foreach $o ("noanonymous", "noplaintext") {
26 push(@cbs, &ui_checkbox("sasl_opts", $o, $text{'sasl_'.$o}, $opts{$o}));
28 print &ui_table_row($text{'sasl_opts'}, join("<br>\n", @cbs), 3);
30 # SASL-related relay restrictions
31 %recip = map { $_, 1 }
32 split(/[\s,]+/, &get_current_value("smtpd_recipient_restrictions"));
34 foreach $o (&list_smtpd_restrictions()) {
35 push(@cbs, &ui_checkbox("sasl_recip", $o, $text{'sasl_'.$o},
38 print &ui_table_row($text{'sasl_recip'}, join("<br>\n", @cbs), 3);
41 &option_yesno("smtpd_delay_reject");
46 if ($postfix_version >= 2.3) {
47 $level = &get_current_value("smtpd_tls_security_level");
48 print &ui_table_row($text{'opts_smtpd_use_tls'},
49 &ui_select("smtpd_tls_security_level", $level,
50 [ [ "", $text{'default'} ],
51 [ "none", $text{'sasl_level_none'} ],
52 [ "may", $text{'sasl_level_may'} ],
53 [ "encrypt", $text{'sasl_level_encrypt'} ] ]));
56 &option_yesno("smtpd_use_tls");
59 &option_radios_freefield("smtpd_tls_cert_file", 60, $none);
61 &option_radios_freefield("smtpd_tls_key_file", 60, $none);
63 &option_radios_freefield("smtpd_tls_CAfile", 60, $none);
67 # Outgoing authentication options
68 &option_radios_freefield("relayhost", 45, $text{'opts_direct'});
70 # Get the current map value for the relayhost
71 $rh = &get_current_value("relayhost");
72 $rh =~ s/^\[(.*)\]$/$1/g;
74 $pmap = &get_maps("smtp_sasl_password_maps");
75 foreach my $o (@$pmap) {
76 if ($o->{'name'} eq $rh) {
77 ($ruser, $rpass) = split(/:/, $o->{'value'});
81 print &ui_table_row($text{'sasl_login'},
82 &ui_radio("login_none", $ruser ? 0 : 1,
83 [ [ 1, $text{'sasl_nologin'}."<br>" ],
84 [ 0, &text('sasl_userpass',
85 &ui_textbox("login_user", $ruser, 20),
86 &ui_textbox("login_pass", $rpass, 20)) ] ]), 3);
88 print &ui_table_end();
89 print &ui_form_end([ [ undef, $text{'opts_save'} ] ]);
91 &ui_print_footer("", $text{'index_return'});