mirror of
https://github.com/phishingclub/phishingclub.git
synced 2026-10-03 05:56:52 +02:00
Merge branch 'feat-set-helo-ehlo' into develop
This commit is contained in:
8 files changed
+68
-2
No files matched your search
@@ -23,6 +23,9 @@ type SMTPConfiguration struct {
|
||||
Username string `gorm:"not null;"`
|
||||
Password string `gorm:"not null;"`
|
||||
IgnoreCertErrors bool `gorm:"not null;"`
|
||||
// Helo is the hostname sent in the SMTP HELO/EHLO greeting.
|
||||
// empty means go-mail falls back to the machine hostname.
|
||||
Helo string `gorm:"not null;default:'';"`
|
||||
|
||||
// back-reference
|
||||
Headers []*SMTPHeader
|
||||
|
||||
@@ -20,6 +20,7 @@ type SMTPConfiguration struct {
|
||||
Username nullable.Nullable[vo.OptionalString255] `json:"username"`
|
||||
Password nullable.Nullable[vo.OptionalString255] `json:"password"`
|
||||
IgnoreCertErrors nullable.Nullable[bool] `json:"ignoreCertErrors"`
|
||||
Helo nullable.Nullable[vo.OptionalString255] `json:"helo"`
|
||||
CompanyID nullable.Nullable[uuid.UUID] `json:"companyID"`
|
||||
Company *Company `json:"company"`
|
||||
Headers []*SMTPHeader `json:"headers"`
|
||||
@@ -89,6 +90,12 @@ func (s *SMTPConfiguration) ToDBMap() map[string]any {
|
||||
m["ignore_cert_errors"] = ignoreCertErrors
|
||||
}
|
||||
}
|
||||
if s.Helo.IsSpecified() {
|
||||
m["helo"] = ""
|
||||
if helo, err := s.Helo.Get(); err == nil {
|
||||
m["helo"] = helo.String()
|
||||
}
|
||||
}
|
||||
if v, err := s.CompanyID.Get(); err == nil {
|
||||
m["company_id"] = v.String()
|
||||
}
|
||||
|
||||
@@ -283,6 +283,7 @@ func ToSMTPConfiguration(
|
||||
username := nullable.NewNullableWithValue(*vo.NewOptionalString255Must(row.Username))
|
||||
password := nullable.NewNullableWithValue(*vo.NewOptionalString255Must(row.Password))
|
||||
ignoreCertErrors := nullable.NewNullableWithValue(row.IgnoreCertErrors)
|
||||
helo := nullable.NewNullableWithValue(*vo.NewOptionalString255Must(row.Helo))
|
||||
|
||||
return &model.SMTPConfiguration{
|
||||
ID: id,
|
||||
@@ -295,6 +296,7 @@ func ToSMTPConfiguration(
|
||||
Username: username,
|
||||
Password: password,
|
||||
IgnoreCertErrors: ignoreCertErrors,
|
||||
Helo: helo,
|
||||
Headers: headers,
|
||||
}
|
||||
}
|
||||
@@ -3112,6 +3112,13 @@ func (c *Campaign) sendCampaignMessages(
|
||||
},
|
||||
),
|
||||
}
|
||||
// use a custom HELO/EHLO hostname when set, otherwise go-mail
|
||||
// falls back to the machine hostname
|
||||
if helo, err := smtpConfig.Helo.Get(); err == nil {
|
||||
if h := helo.String(); len(h) > 0 {
|
||||
emailOptions = append(emailOptions, mail.WithHELO(h))
|
||||
}
|
||||
}
|
||||
// setup authentication if provided
|
||||
username, err := smtpConfig.Username.Get()
|
||||
if err != nil {
|
||||
@@ -5554,6 +5561,14 @@ func (c *Campaign) sendSingleEmailSMTP(
|
||||
),
|
||||
}
|
||||
|
||||
// use a custom HELO/EHLO hostname when set, otherwise go-mail
|
||||
// falls back to the machine hostname
|
||||
if helo, err := smtpConfig.Helo.Get(); err == nil {
|
||||
if h := helo.String(); len(h) > 0 {
|
||||
emailOptions = append(emailOptions, mail.WithHELO(h))
|
||||
}
|
||||
}
|
||||
|
||||
// setup authentication if provided
|
||||
username, err := smtpConfig.Username.Get()
|
||||
if err != nil {
|
||||
|
||||
@@ -532,6 +532,13 @@ func (m *Email) SendTestEmail(
|
||||
},
|
||||
),
|
||||
}
|
||||
// use a custom HELO/EHLO hostname when set, otherwise go-mail
|
||||
// falls back to the machine hostname
|
||||
if helo, err := smtp.Helo.Get(); err == nil {
|
||||
if h := helo.String(); len(h) > 0 {
|
||||
emailOptions = append(emailOptions, mail.WithHELO(h))
|
||||
}
|
||||
}
|
||||
// setup authentication if provided
|
||||
username, err := smtp.Username.Get()
|
||||
if err != nil {
|
||||
|
||||
@@ -242,6 +242,13 @@ func (s *SMTPConfiguration) SendTestEmail(
|
||||
},
|
||||
),
|
||||
}
|
||||
// use a custom HELO/EHLO hostname when set, otherwise go-mail
|
||||
// falls back to the machine hostname
|
||||
if helo, err := smtpConfig.Helo.Get(); err == nil {
|
||||
if h := helo.String(); len(h) > 0 {
|
||||
emailOptions = append(emailOptions, mail.WithHELO(h))
|
||||
}
|
||||
}
|
||||
// setup authentication if provided
|
||||
username, err := smtpConfig.Username.Get()
|
||||
if err != nil {
|
||||
@@ -454,6 +461,9 @@ func (s *SMTPConfiguration) UpdateByID(
|
||||
if v, err := incoming.IgnoreCertErrors.Get(); err == nil {
|
||||
current.IgnoreCertErrors.Set(v)
|
||||
}
|
||||
if v, err := incoming.Helo.Get(); err == nil {
|
||||
current.Helo.Set(v)
|
||||
}
|
||||
if err := incoming.Validate(); err != nil {
|
||||
s.Logger.Errorw("failed to update SMTP configuration", "error", err)
|
||||
return err
|
||||
@@ -656,6 +666,13 @@ func (s *SMTPConfiguration) SendMessages(
|
||||
},
|
||||
),
|
||||
}
|
||||
// use a custom HELO/EHLO hostname when set, otherwise go-mail
|
||||
// falls back to the machine hostname
|
||||
if helo, err := smtpConfig.Helo.Get(); err == nil {
|
||||
if h := helo.String(); len(h) > 0 {
|
||||
emailOptions = append(emailOptions, mail.WithHELO(h))
|
||||
}
|
||||
}
|
||||
username, err := smtpConfig.Username.Get()
|
||||
if err != nil {
|
||||
s.Logger.Errorw("failed to get smtp username", "error", err)
|
||||
|
||||
@@ -2016,6 +2016,7 @@ export class API {
|
||||
* @param {string} configuration.username
|
||||
* @param {string} configuration.password
|
||||
* @param {boolean} configuration.ignoreCertErrors
|
||||
* @param {string} configuration.helo
|
||||
* @param {string} configuration.companyID
|
||||
* @returns
|
||||
*/
|
||||
@@ -2034,6 +2035,7 @@ export class API {
|
||||
* @param {string} configuration.username
|
||||
* @param {string} configuration.password
|
||||
* @param {boolean} configuration.ignoreCertErrors
|
||||
* @param {string} configuration.helo
|
||||
* @param {string} configuration.companyID
|
||||
* @returns {Promise<ApiResponse>}
|
||||
*/
|
||||
|
||||
@@ -54,7 +54,8 @@
|
||||
port: null,
|
||||
username: null,
|
||||
password: null,
|
||||
ignoreCertErrors: null
|
||||
ignoreCertErrors: null,
|
||||
helo: null
|
||||
};
|
||||
let headerFormValues = {
|
||||
id: null,
|
||||
@@ -206,6 +207,7 @@
|
||||
username: formValues.username,
|
||||
password: formValues.password,
|
||||
ignoreCertErrors: formValues.ignoreCertErrors,
|
||||
helo: formValues.helo,
|
||||
companyID: contextCompanyID
|
||||
});
|
||||
if (!res.success) {
|
||||
@@ -233,6 +235,7 @@
|
||||
username: formValues.username,
|
||||
password: formValues.password,
|
||||
ignoreCertErrors: formValues.ignoreCertErrors,
|
||||
helo: formValues.helo,
|
||||
companyID: formValues.companyID
|
||||
});
|
||||
if (res.success) {
|
||||
@@ -381,7 +384,8 @@
|
||||
port: configuration.port,
|
||||
username: configuration.username,
|
||||
password: configuration.password,
|
||||
ignoreCertErrors: configuration.ignoreCertErrors
|
||||
ignoreCertErrors: configuration.ignoreCertErrors,
|
||||
helo: configuration.helo
|
||||
};
|
||||
};
|
||||
|
||||
@@ -560,6 +564,15 @@
|
||||
bind:value={formValues.port}
|
||||
placeholder="587">Port</TextField
|
||||
>
|
||||
<TextField
|
||||
minLength={0}
|
||||
maxLength={255}
|
||||
bind:value={formValues.helo}
|
||||
placeholder="mail.example.test"
|
||||
optional={true}
|
||||
toolTipText="Hostname sent in the SMTP HELO/EHLO greeting. Leave empty to use the server's own hostname."
|
||||
>HELO/EHLO Hostname</TextField
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in new issue
Block a user