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

after build, postdove sees localhost.localdomain + localhost domains as internet class ,not local class #1

Open
UlasSAYGINIM opened this issue Apr 20, 2023 · 8 comments

Comments

@UlasSAYGINIM
Copy link

i tested on hardenedbsd 13.2

postdove show domain localhost

Name: localhost
Class: internet
Transport: --
UserID: --
Group ID: --
Restrictions: --

postdove show domain localhost.localdomain
Name: localhost.localdomain
Class: internet
Transport: --
UserID: --
Group ID: --
Restrictions: --

@lieb
Copy link
Owner

lieb commented Apr 20, 2023

Interesting. I checked maildb/files/domains and it shows "local" in the files. I also checked my own install and it is the same. BTW, localhost.localdomain is standard for a raw install of Fedora and other linux distros. It gets deleted as part of configuration since the domain is non-existent post system config. I checked the history on the domains file and it's always been "local".
That being said, I've only built and tested on linux (Fedora). "internet" is the iota const, i.e. 0. How did you build? and did you do a postdove create ? I also notice that vuid and vgid are not set which should have happened when the postdove create populated the database. See:
https://github.com/lieb/postdove/blob/master/doc/create_reference.md

If you started with an empty database and inserted them manually, they default to "internet" and unset userid/gid.
doing a simple 'postdove create' should do the right thing. If not, detail your build and install since I don't have a BSD machine.

@UlasSAYGINIM
Copy link
Author

UlasSAYGINIM commented May 21, 2023

thank you for information. sorry i am late. i used your instructions but i need to say hardenedbsd is not linux. so i need to pass some of the steps or i need to change some of the step to be suitable with unix command lines.

yes i noticed that
UserID: --
Group ID: --

not like your tutorial 99 but it is also not 99 on unix system. is there any check if it is 99 it writes 99
if not 99 , not writes.

how to insert UID and GID to database, i couldnt see the command?

Database Creation

mkdir -p /postfixdb/

chmod 750 /postfixdb/

chown root:mail /postfixdb/

cd /postfixdb

postdove create -d "/postfixdb/postdove.sqlite"

ls -al
total 10
drwxr-x--- 2 root mail 3 20 Nis 02:46 .
drwxr-xr-x 4 root wheel 4 20 Nis 01:35 ..
-rw-r--r-- 1 root mail 69632 20 Nis 02:46 postdove.sqlite

i created db like this.

i have built like

cd /sp/postdove

go get

go generate

grep generate main.go

//go:generate bash set_version.sh

cat ./set_version.sh

#!/bin/bash
git describe > cmd/version.txt

go generate

We now have the file ./cmd/version.txt

cat ./cmd/version.txt
V0.9

root:/sp/postdove # go build

ls -l postdove
-rwxr-xr-x 1 root wheel 8790208 20 Nis 01:27 postdove

@UlasSAYGINIM
Copy link
Author

vuid and vgid are recorded only for localhost in sqlite database. but there is no vgid and vuid for localhost.localdomain.it is null.

one thing i want to ask, you are inserting record with one field in to domain or address table,you do not set any id for it. but when i looked table definitions are not set autoincrement id. but some how you got increment id. i could not find documentation about it. which part of the code decides id values because it seems unreliable for me.

in addition this, there are things which is not mentioned in documents. such as, when i am creating new mailbox to domain,i should now the real path of maildir,and i need to set gid and uid , it does not automaticly sets it.
another thing password as recorded without encrypted by postdove even password type selected SHA256.
it think it is my duty. but i wonder if i set password SHA256,can it be understandable by both postfix and dovecot.

on freebsd and hardenedbsd side, nobody user id is different than fedora.

id nobody
uid=65534(nobody) gid=65534(nogroup) groups=65534(nogroup)

in this case, setting vgid and vuid must be started 70000 to not to mix anything.

i found error on virtual_mailbox.query. it does not work properly when home is null.
i fixed it.i will create pull request after i finished it.

there is also no virtual_gid_maps.query and virtual_uid_maps.query. i also created them.

i will look further than i will inform you.

thank you for this great work.

@UlasSAYGINIM
Copy link
Author

UlasSAYGINIM commented May 26, 2023

hi,
i have found some features of postdove. correct me if i am wrong.
first of all only SHA256 password type is accepted sha512and others not implemented.
for password enter , there is bug if you use doveadm pw -s SHA256-CRYPT to get password hash.
it gives "$5$" and other characters that postdove command line thinks it is another command line argument to parse.
it gives error. even if i used -p "$5$AUM3eXg4kpk.CP$xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxEAd/e/"

we have to create always the mail box user path manually, postdove does not create itself.

in this case we need to be carefull about permission while creating paths.

for user mail box , if we do not write full path of mailbox with ,--mail-home , the user mailbox will not be usable.

@UlasSAYGINIM
Copy link
Author

there is no smtpd_sender_login_maps so, logged user can send email as another user. for example,
[email protected] logged user and he can send mail as [email protected]

@lieb
Copy link
Owner

lieb commented Aug 19, 2023

Sorry I haven't gotten back. I was assuming github would send me a notify...
Thanks for the info. I've got an update in the pipeline that I'll be committing at some point after I finish a pre-release of the project I am on now. I don't have BSD bits laying around so while I can include you contribution, I would need your testing. I need to study your comments further before replying. More later.

@UlasSAYGINIM
Copy link
Author

you can add me as contributor no problem. thank you. i am waiting your response.

@UlasSAYGINIM
Copy link
Author

for tests I got some fail results,
I could not understand now, I will look at it. can you help me about it?

TESTS RESULTS

root@vps-afa9a42e:/server_programs/postdove # ./test_all.sh
RFC822 Test
PASS
ok github.com/lieb/postdove/maildb 0.006s
Target Test
PASS
ok github.com/lieb/postdove/maildb 0.005s
Transport Decode Test
PASS
ok github.com/lieb/postdove/maildb 0.005s
Database load test
PASS
ok github.com/lieb/postdove/maildb 0.015s
Access Test
PASS
ok github.com/lieb/postdove/maildb 0.020s
Transport Test
PASS
ok github.com/lieb/postdove/maildb 0.022s
Domain Test
Bad class (jazz)
PASS
ok github.com/lieb/postdove/maildb 0.030s
Address Test
PASS
ok github.com/lieb/postdove/maildb 0.052s
Alias ops Test
PASS
ok github.com/lieb/postdove/maildb 0.083s
Mailbox Test
PASS
ok github.com/lieb/postdove/maildb 0.038s
Test_Import
Test_Simple
Test_Simple errors
Test_Postfix
Test_Postfix errors
Test_Aliases
Test_Password
PASS
ok github.com/lieb/postdove/cmd 0.005s
Test_Cmds
--- FAIL: Test_Cmds (5.33s)
cmds_test.go:97: Create no flags: Unexpected error, Create command: loadSchema: line 4:
-- transport table
DROP TABLE IF EXISTS "Transport", FOREIGN KEY constraint failed
cmds_test.go:112: Create bad db: Unexpected error, Create command: loadSchema: line 2: --
-- Access table
-- Table rows match smtpd_restriction_classes list actually implemented
-- in postfix. The names are the set of acceptable choices in the UI and
-- we catch editing errors here rather than in the postfix runtime
DROP TABLE IF EXISTS "Access", database is locked
FAIL
exit status 1
FAIL github.com/lieb/postdove/cmd 5.332s
TestAccess
PASS
ok github.com/lieb/postdove/cmd 0.043s
TestTransport
PASS
ok github.com/lieb/postdove/cmd 0.037s
TestTransportEdit
edit nexthop to somewhere.org
PASS
ok github.com/lieb/postdove/cmd 0.023s
TestTransportAdd
PASS
ok github.com/lieb/postdove/cmd 0.028s
TestTransportAddOne
PASS
ok github.com/lieb/postdove/cmd 0.018s
Test_Domain
domains from stdin
domains from file
PASS
ok github.com/lieb/postdove/cmd 0.050s
Test_Address
PASS
ok github.com/lieb/postdove/cmd 0.067s
TestAliasCmds
PASS
ok github.com/lieb/postdove/cmd 0.094s
Test_VMailboxCmd
PASS
ok github.com/lieb/postdove/cmd 0.045s
Test_Create
PASS
ok github.com/lieb/postdove/cmd 0.057s
TestCreateNoAliases
PASS
ok github.com/lieb/postdove/cmd 0.032s
TestViews
Domain class types
Domain access
user@domain access
Transport lookups
Domain lookups
Local Alias lookups
Virtual alias lookups
Lookup all users
Lookup prefetch of [email protected]
Lookup user
Lookup bogus user
Deny allow
Deny deny
Relay gramma@cottage
Relay [email protected]
--- FAIL: TestViews (0.07s)
views_test.go:646: Lookup a prefetch password: Expected 1 matched rows from view, got 0([map[domain:pobox.org password:{PLAIN}* userdb_gid:65534 userdb_home: userdb_quota_rule:*:bytes=300M userdb_uid:65534 username:jeff]])
FAIL
exit status 1
FAIL github.com/lieb/postdove/cmd 0.075s

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

No branches or pull requests

2 participants