Re: James Webadmin

cryptearth <[email protected]> Fri, 7 Feb 2025 08:07:01 +0100
Newsgroups gmane.comp.jakarta.james.user
Message-ID <[email protected]>
Hello Ilya,

sorry for my late reply to that topic.

As you seem to have figured out by now: The webadmin isn't an web admin 
panel but rather just an REST api.

First of all I have to stress about security: As for now webadmin 
doesn't have any proper security. Everyone who has access to it has full 
control over your james mail server. So don't make it available from the 
public as it's a huge security issue. Only have that port bound local 
and protect it via the firewall to only have it accessible from a local 
endpoint! Otherwise you expose admin control to your james server to the 
internet without any protection and it will become a public spam rely in 
a matter of minutes.
So if you have webadmin accessible from outside via your domain close 
that whole immediately! An open spam relay is nothing to joke about as 
it can cause huge traffic within minutes and ruin your domain 
reputation. I had it happen to me twice already and it takes some effort 
to get off all those spam lists again.

As for how to clean a users inboxes when deleting a user:

For 3.8.x I would first list all folders by

GET http://ip:port/users/{usernameToBeUsed}/mailboxes

iterate over the list and clear all mails

DELETE 
http://ip:port/users/{usernameToBeUsed}/mailboxes/{mailboxName}/messages

and finally delete the folder itself

DELETE 
http://ip:port/users/{usernameToBeUsed}/mailboxes/{mailboxNameToBeDeleted}

One could also go other ways like first deleting all messages via IMAP 
and then the folders via direct database access - but I guess it's 
better to inject such job via the webadmin as otherwise it could stress 
james on big users or could even break things by directly a-sync manip 
the database.

As for a graphical client: 
https://www.mail-archive.com/[email protected]/msg16930.html 
- I already came up with that idea pretty much a year ago - no started 
to write down a single line yet =D

So long ...

Matt


Am 07.02.25 um 04:37 schrieb Ilya Terskov:
> Hi Benoit. Then how i should delete user and his mailbox?
> If i just delete and create user with same name it have all messages he
> have before deleting. How clear data about user completely?
>
> чт, 6 февр. 2025 г. в 16:33, Benoit TELLIER <[email protected]>:
>
>> This route is not available on 3.8.x release of James but on later changes
>>
>> To use it either run on master or wait a 3.9.0 release.
>>
>> Refer to
>> https://james.staged.apache.org/james-distributed-app/3.8.1/operate/webadmin.html to
>> see what is supported for your release. Be mindful that some of those are
>> specific to the distributed server and are not bound for JPA (as it do not
>> make sense)
>>
>> --
>>
>> Best regards,
>>
>> Benoit TELLIER
>>
>> General manager of Linagora VIETNAM.
>> Product owner for Team-Mail product.
>> Chairman of the Apache James project.
>>
>> Mail: [email protected]
>> Tel: (0033) 6 77 26 04 58 (WhatsApp, Signal)
>>
>>
>> On Feb 6, 2025 7:30 AM, from Tran Tung <[email protected]>The response
>> is from the james webadmin,
>>
>> The request looks normal.
>>
>> But that response for case when route (endpoint) was not installed.
>>
>> Sorry, I don't know why
>>
>>
>> On 2/6/25 1:12 PM, Ilya Terskov wrote:
>>> lets try with yandex disk :)
>>> disk.yandex.ru/d/TSyMSKHlHSEzlw
>>>
>>> чт, 6 февр. 2025 г. в 13:05, Tran Tung <[email protected]>:
>>>
>>>> I don't see your screenshots
>>>>
>>>> On 2/6/25 11:24 AM, Ilya Terskov wrote:
>>>>> thanks but this not work, correct me if i am done wrong http request
>>>>>
>>>>> here screenshots curl and insomnia
>>>>>
>>>>> чт, 6 февр. 2025 г. в 10:34, Tran Tung <[email protected]>:
>>>>>
>>>>>       Hi,
>>>>>
>>>>>       Bellow is syntax sample, that I extract from source code:
>>>>>
>>>>>       (1)
>>>>>
>>>>>       Request method:    POST
>>>>>       Request URI:
>>>>>
>>>> http://localhost:61390/users/jessy.jones%40domain.tld?action=deleteData
>>>>>       Proxy:            <none>
>>>>>       Request params:    <none>
>>>>>       Query params:    action=deleteData
>>>>>       Form params:    <none>
>>>>>       Path params:    <none>
>>>>>       Headers:        Accept=application/json, application/javascript,
>>>>>       text/javascript, text/json
>>>>>                        Content-Type=application/json; charset=UTF-8
>>>>>       Cookies:        <none>
>>>>>       Multiparts:        <none>
>>>>>       Body:            <none>
>>>>>
>>>>>
>>>>>       (2)
>>>>>
>>>>>       Request method:    POST
>>>>>       Request URI:
>>>>>       http://localhost:61496/domains/localhost?action=deleteData
>>>>>       Proxy:            <none>
>>>>>       Request params:    <none>
>>>>>       Query params:    action=deleteData
>>>>>       Form params:    <none>
>>>>>       Path params:    <none>
>>>>>       Headers:        Accept=application/json, application/javascript,
>>>>>       text/javascript, text/json
>>>>>                        Content-Type=application/json; charset=UTF-8
>>>>>       Cookies:        <none>
>>>>>       Multiparts:        <none>
>>>>>       Body:            <none>
>>>>>
>>>>>
>>>>>       Cheers,
>>>>>
>>>>>
>>>>>       On 2/6/25 10:25 AM, Ilya Terskov wrote:
>>>>>       > Hi guys once more!
>>>>>       > Can u tell me about how actual this info?
>>>>>       >
>>>>>
>>>> james.apache.org/server/manage-webadmin.html#Administrating_users
>>>>>       > especially this one
>>>>>       >
>>>>>       > curl -XPOST http://ip:port
>>>> /users/usernameToBeUsed?action=deleteData
>>>>>       >
>>>>>       > and
>>>>>       >
>>>>>       > curl -XPOST
>>>>>       http://ip:port/domains/{domainToBeUsed}?action=deleteData
>>>>>       >
>>>>>       >
>>>>>       > Both commands return error
>>>>>       >
>>>>>       > i tried with curl and insomnia
>>>>>       >
>>>>>       > where i can find most actual info about http request syntax?
>>>>>       >
>>>>>
>>>>>
>> ---------------------------------------------------------------------
>>>>>       To unsubscribe, e-mail: [email protected]
>>>>>       For additional commands, e-mail:
>> [email protected]
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail:[email protected]
>>>>> For additional commands, e-mail:[email protected]
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>
>>