Layer7 API Management

  • 1.  [Portal 4.2] How to activate user account without email

    Posted Feb 27, 2018 01:47 AM

    Hi, Expert.

    For the PoC purpose, my portal installation does not have official email domain, so that email notification cannot be delivered sometimes.

    Are there anyway to activate user account even if the email infrastructure is not ready?

    As I know there was a work around with using token value in database before.

    Does anyone know how to do it in postgre sql of current portal 4.2 or another way?



  • 2.  Re: [Portal 4.2] How to activate user account without email

    Posted Feb 27, 2018 02:38 PM

    Hi!

    I've had the same issue you have. A workaround solution I've found is to get the messages stuck in the Postfix mail queue.

    In order to access those messages, you have to do the following:

     

    • Access the shell from the Linux machine where your Portal is running.
    • List the running containers running the command:
      • sudo docker ps
    • Locate the SMTP Server container. It looks like this:
      • apim-portal.packages.ca.com/apim-portal/smtp:4.2.2.1
    • Copy the container ID: It looks like this:
      • portal_smtp.1.d5yiymumtp6vbp5hbnvyx4ppq
    • Access the shell from the SMTP Server container, running the command:
      • sudo docker exec -it <container ID> /bin/sh
    • Once inside the SMTP Server, you can list the queued mails running:
      • postqueue -p
    • Find the message you are looking for and read it using the following command:
      • postcat -vq <message ID>

     

    Now that you have access to activation links, you can test the onboarding flow.

     

    I hope that helps.

     

    Regards!

     

    Alex Siqueira

    Services Architect - Cybersecurity and API Management

    Sao Paulo, Brazil



  • 3.  Re: [Portal 4.2] How to activate user account without email

    Posted Feb 27, 2018 07:47 PM

    Thanks, Alex.

    I tried it, however looks like all emails are already posted and receiver mail system does not accept it.

    Anyway your solution would be helpful if in case that email is pending in postfix queue.

     

    / # postqueue -p
    postqueue: warning: Mail system is down -- accessing queue directly
    Mail queue is empty
    / #



  • 4.  Re: [Portal 4.2] How to activate user account without email
    Best Answer

    Posted Feb 27, 2018 09:17 PM

    I have had time to investigation then found solution.

    This exactly work for me. Please refer to below.

     

    1. Find container id of postgres
    >sudo docker ps | grep postgres

     

    2. Enter into postgre server container
    > sudo docker exec -it <container id> /bin/sh

     

    3. Connect postgre SQL server
    > psql --username=postgres

     

    4. Connect Portal Database
    > \connect portal

     

    5. List tokens that is waiting activation.
    (** Note: only upper case characters are accepted in query statement, and semi colon is required at the end of query statement)
    > SELECT * FROM portal_token;

     

    6. Find right “token” column through looking at “create_ts” and other columns

     

    7. Access below URL in browser
    > https://<tenant FQDN>/admin/app/account-setup#token/<token value>



  • 5.  Re: [Portal 4.2] How to activate user account without email

    Broadcom Employee
    Posted Apr 10, 2018 06:57 PM

    Another way is to use Portal API, for example,(the command line will be different depends on your env)

    curl --include   --header "Authorization:Bearer ea573fad-e10e-455f-88be-e7630de940e4"  --header "Content-Type:application/json;charset=UTF-8" \
      --data '{
      "Uuid": "5025fc26-0874-4de6-bbcc-d6be28cb591d",
      "FirstName": "Test",
      "LastName": "User",
      "Username": "testuser",
      "Email": "myemail@ca.com",
      "RoleUuid": "00000006-0006-0006-0006-000000000006",
      "OrganizationUuid": "5a13373d-ea2d-4427-a929-3d8f591dfc06",
      "NotifyUser": false,
      "Locale": "EN",
      "Status": "ENABLED"
    }' \
      --request PUT "https://apim-ssg.local:9443/apim/Users('5025fc26-0874-4de6-bbcc-d6be28cb591d')"

     

    Or call the same API on API explorer