Skip to content

Fix dkim selection not being selectable#2743

Open
Wolf1098 wants to merge 14 commits into
simple-login:masterfrom
Wolf1098:fix-dkim-selection
Open

Fix dkim selection not being selectable#2743
Wolf1098 wants to merge 14 commits into
simple-login:masterfrom
Wolf1098:fix-dkim-selection

Conversation

@Wolf1098

@Wolf1098 Wolf1098 commented Jun 4, 2026

Copy link
Copy Markdown

See #2742

Wolf1098 added 2 commits June 4, 2026 03:07
Read DKIM_SELECTOR from environment variable with default value  'dkim' and encode it for byte consumption.
Clarified DKIM private key and selector comments in example.env
Wolf1098 added 3 commits June 6, 2026 10:24
Updated DKIM_SELECTOR and DKIM_SELECTORS_LIST retrieval from environment variables, with defaults for dehard-coding.
@Wolf1098

Wolf1098 commented Jun 7, 2026

Copy link
Copy Markdown
Author

investigating how templates find its dkim values, have not found the single authorative source of dkim selector in the code yet.

Wolf1098 and others added 2 commits June 7, 2026 16:44
    - refined dkim_selector and dkim_valid_selectors_list loading logic,
    - moved encode logic from dkim_selector  to email_utils.py
	modified:   app/custom_domain_validation.py
    - use config.DKIM_VALID_SELECTORS_LIST instead of hardcoded selector list
	modified:   app/email_utils.py
    - encode config.DKIM_SELECTOR when signing email with dkim
      constructor for method already encodes other inputs
@Wolf1098

Wolf1098 commented Jun 8, 2026

Copy link
Copy Markdown
Author
Image
# WebApp URL
URL=http://smtplogin.wolfietech.xyz

# domain used to create alias
EMAIL_DOMAIN=smtplogin.wolfietech.xyz
ALIAS_DOMAIN=relay.wolfietech.xyz

# transactional email is sent from this email address
SUPPORT_EMAIL=smtplogin-support@relay.wolfietech.xyz

# custom domain needs to point to these MX servers
EMAIL_SERVERS_WITH_PRIORITY=[(5, "mx01.wolfietech.cloud.")]

# By default, new aliases must end with ".{random_word}". This is to avoid a person taking all "nice" aliases.
# this option doesn't make sense in self-hosted. Set this variable to disable this option.
DISABLE_ALIAS_SUFFIX=1

# the DKIM private key used to compute DKIM-Signature
DKIM_PRIVATE_KEY_PATH=/dkim.key
DKIM_SELECTOR=smtplogin

# DB Connection
DB_URI=postgresql://simplelogin:pass@host/simplelogin

FLASK_SECRET=secret

GNUPGHOME=/sl/pgp

LOCAL_FILE_UPLOAD=1

POSTFIX_SERVER="mx-host"
POSTFIX_PORT=25

@Wolf1098

Wolf1098 commented Jun 8, 2026

Copy link
Copy Markdown
Author

SHOULD BE NOTED IF wanting to run against this pr EASILY... (NOT ON PRODUCTION, NO WARRANTY TO DOWNGRADES)

-v $(pwd)/simplelogin-fork/app/config.py:/code/app/config.py \
-v $(pwd)/simplelogin-fork/app/custom_domain_validation.py:/code/app/custom_domain_validation.py \
-v $(pwd)/simplelogin-fork/app/email_utils.py:/code/app/email_utils.py \
simplelogin/app-ci@sha256:2497bdc135060f449ef88145e62c6c29fb863b9d2d628bca6ad5288d5ea56946 \`flask db upgrade`  has *SEEMINGLY* been replaced with `alembic upgrade head`

Instructions:
clone repo to the main folder directory with dkim.key and sl/ ; NAMING the clone simplelogin-fork( for examples below)

pull the pr #2743 in that directory.

go back to the, above, main folder.

add to the simplelogin.env: FOR EXAMPLE:

>  DKIM_SELECTOR=key02 
>  DKIM_VALID_SELECTORS_LIST="key01,key02" 
docker run --rm \
    --name sl-migration \
    -v $(pwd)/sl:/sl \
    -v $(pwd)/sl/upload:/code/static/upload \
    -v $(pwd)/dkim.key:/dkim.key \
    -v $(pwd)/dkim.pub.key:/dkim.pub.key \
    -v $(pwd)/simplelogin.env:/code/.env \
    --network="sl-network" \
    -v $(pwd)/simplelogin-fork/app/config.py:/code/app/config.py \
    -v $(pwd)/simplelogin-fork/app/custom_domain_validation.py:/code/app/custom_domain_validation.py \
    -v $(pwd)/simplelogin-fork/app/email_utils.py:/code/app/email_utils.py \
    simplelogin/app-ci@sha256:2497bdc135060f449ef88145e62c6c29fb863b9d2d628bca6ad5288d5ea56946 \
    alembic upgrade head

docker run --rm \
    --name sl-init \
    -v $(pwd)/sl:/sl \
    -v $(pwd)/simplelogin.env:/code/.env \
    -v $(pwd)/dkim.key:/dkim.key \
    -v $(pwd)/dkim.pub.key:/dkim.pub.key \
    --network="sl-network" \
    -v $(pwd)/simplelogin-fork/app/config.py:/code/app/config.py \
    -v $(pwd)/simplelogin-fork/app/custom_domain_validation.py:/code/app/custom_domain_validation.py \
    -v $(pwd)/simplelogin-fork/app/email_utils.py:/code/app/email_utils.py \
    simplelogin/app-ci@sha256:2497bdc135060f449ef88145e62c6c29fb863b9d2d628bca6ad5288d5ea56946 \
    python init_app.py

docker run -d \
    --name sl-app \
    -v $(pwd)/sl:/sl \
    -v $(pwd)/sl/upload:/code/static/upload \
    -v $(pwd)/simplelogin.env:/code/.env \
    -v $(pwd)/dkim.key:/dkim.key \
    -v $(pwd)/dkim.pub.key:/dkim.pub.key \
    -p 127.0.0.1:7777:7777 \
    --restart always \
    --network="sl-network" \
    -v $(pwd)/simplelogin-fork/app/config.py:/code/app/config.py \
    -v $(pwd)/simplelogin-fork/app/custom_domain_validation.py:/code/app/custom_domain_validation.py \
    -v $(pwd)/simplelogin-fork/app/email_utils.py:/code/app/email_utils.py \
    simplelogin/app-ci@sha256:2497bdc135060f449ef88145e62c6c29fb863b9d2d628bca6ad5288d5ea56946

docker run -d \
    --name sl-email \
    -v $(pwd)/sl:/sl \
    -v $(pwd)/sl/upload:/code/static/upload \
    -v $(pwd)/simplelogin.env:/code/.env \
    -v $(pwd)/dkim.key:/dkim.key \
    -v $(pwd)/dkim.pub.key:/dkim.pub.key \
    -p 127.0.0.1:20381:20381 \
    --restart always \
    --network="sl-network" \
    -v $(pwd)/simplelogin-fork/app/config.py:/code/app/config.py \
    -v $(pwd)/simplelogin-fork/app/custom_domain_validation.py:/code/app/custom_domain_validation.py \
    -v $(pwd)/simplelogin-fork/app/email_utils.py:/code/app/email_utils.py \
    simplelogin/app-ci@sha256:2497bdc135060f449ef88145e62c6c29fb863b9d2d628bca6ad5288d5ea56946 \
    python email_handler.py

docker run -d \
    --name sl-job-runner \
    -v $(pwd)/sl:/sl \
    -v $(pwd)/sl/upload:/code/static/upload \
    -v $(pwd)/simplelogin.env:/code/.env \
    -v $(pwd)/dkim.key:/dkim.key \
    -v $(pwd)/dkim.pub.key:/dkim.pub.key \
    --restart always \
    --network="sl-network" \
    -v $(pwd)/simplelogin-fork/app/config.py:/code/app/config.py \
    -v $(pwd)/simplelogin-fork/app/custom_domain_validation.py:/code/app/custom_domain_validation.py \
    -v $(pwd)/simplelogin-fork/app/email_utils.py:/code/app/email_utils.py \
    simplelogin/app-ci@sha256:2497bdc135060f449ef88145e62c6c29fb863b9d2d628bca6ad5288d5ea56946 \
    python job_runner.py

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.

1 participant