Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration from Esmith smarthosts to sqlite relayrules #102

Merged
merged 3 commits into from
Apr 12, 2024

Conversation

stephdl
Copy link
Contributor

@stephdl stephdl commented Apr 11, 2024

This pull request adds the import-module/50import_smarthosts action, which allows for importing smarthosts into the relayrules table.

NethServer/dev#6895

we want to migrate from NS7

/sbin/e-smith/db smarthosts printjson | jq
[
  {
    "props": {
      "TlsStatus": "enabled",
      "Password": "",
      "status": "enabled",
      "Username": "",
      "Port": "587",
      "Host": "smtp.domain.com"
    },
    "name": "@tata.com",
    "type": "recipient"
  },
  {
    "props": {
      "TlsStatus": "enabled",
      "Password": "",
      "status": "enabled",
      "Username": "",
      "Port": "587",
      "Host": "smtp.domain.com"
    },
    "name": "@toto.com",
    "type": "sender"
  },
  {
    "props": {
      "TlsStatus": "enabled",
      "Password": "",
      "status": "enabled",
      "Username": "",
      "Port": "587",
      "Host": "smtp.domain.com"
    },
    "name": "[email protected]",
    "type": "recipient"
  },
  {
    "props": {
      "TlsStatus": "enabled",
      "Password": "",
      "status": "enabled",
      "Username": "",
      "Port": "587",
      "Host": "smtp.domain.com"
    },
    "name": "[email protected]",
    "type": "sender"
  }
]

to NS8

[root@R1-pve ~]# api-cli run module/mail1/list-relay-rules | jq
Warning: using user "cluster" credentials from the environment
{
  "has_wildcard": false,
  "rules": [
    {
      "rule_type": "sender",
      "rule_subject": "[email protected]",
      "host": "smtp.domain.com",
      "port": 587,
      "tls": false,
      "username": "",
      "has_password": false,
      "enabled": true
    },
    {
      "rule_type": "sender",
      "rule_subject": "toto.com",
      "host": "smtp.domain.com",
      "port": 587,
      "tls": false,
      "username": "",
      "has_password": false,
      "enabled": true
    },
    {
      "rule_type": "recipient",
      "rule_subject": "[email protected]",
      "host": "smtp.domain.com",
      "port": 587,
      "tls": false,
      "username": "",
      "has_password": false,
      "enabled": true
    },
    {
      "rule_type": "recipient",
      "rule_subject": "tata.com",
      "host": "smtp.domain.com",
      "port": 587,
      "tls": false,
      "username": "",
      "has_password": false,
      "enabled": true
    }
  ]
}

@stephdl stephdl changed the title Add import-module/50import_smarthosts action Migration from Esmith smarthosts to sqlite relayrules Apr 11, 2024
Copy link
Member

@DavidePrincipi DavidePrincipi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, please fix the log call and merge

@DavidePrincipi DavidePrincipi mentioned this pull request Apr 11, 2024
19 tasks
@DavidePrincipi DavidePrincipi merged commit 857e400 into main Apr 12, 2024
1 check passed
@DavidePrincipi DavidePrincipi deleted the feat-6895-migration branch April 12, 2024 10:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants