# Automation of setup-key

**URL:** <https://forum.pritunl.com/t/automation-of-setup-key/1978>\
**Category:** Pritunl\
**Tags:** pritunl\
**Created:** [April 9, 2024, 3:09pm UTC](https://forum.pritunl.com/t/automation-of-setup-key/1978 "2024-04-09T15:09:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ahyben](https://forum.pritunl.com/letter_avatar_proxy/v4/letter/a/71c47a/32.png) [@ahyben](https://forum.pritunl.com/u/ahyben)\
**Post date:** [April 9, 2024, 3:09pm UTC](https://forum.pritunl.com/t/automation-of-setup-key/1978/1 "2024-04-09T15:09:13Z")

</div>

Hello,

I am validating pritunl for our company, but we require 100% automation possibility in our portfolio. We have up-to 20k remote users that are connecting daily and we wanna get rid of our old vendor for remote access VPN.

Now to the problem I have : [NOTE : I started with free version, but we already ordered 1 validating enterprise license as well - because only enterprise include features we wanna use …]

- I wrote playbook to deploy pritunl on linux server, this is working fine
- Now we have steps on page [Configuration (pritunl.com)](https://docs.pritunl.com/docs/configuration-5) to follow and we run into problem.
- We need to automate process of one-time configuration via CLI command, we don’t wanna do it using webUI.

# Working scenario :

- I used CLI command “pritunl setup-key” to generate key
- I opened webUI and I put the ID there.
- then I run command “pritunl default-password”
- I went back to webUI and login

# Not working scenario :

- I used CLI command “pritunl setup-key” to generate key
- I used CLI command ‘pritunl set-mongodb “mongodb://localhost:27017/pritunl”’
- then I run command “pritunl default-password”
- I went back to webUI, but it was still requesting setup-key  
[NOTE : I was unable to find any command to apply setup-key using CLI or REST-API].

Can you please help me ?

---

<div class="post-metadata">

**Author:** ![zach](https://forum.pritunl.com/user_avatar/forum.pritunl.com/zach/32/1105_2.png) [@zach](https://forum.pritunl.com/u/zach)\
**Post date:** [April 11, 2024, 2:43am UTC](https://forum.pritunl.com/t/automation-of-setup-key/1978/2 "2024-04-11T02:43:22Z")

</div>

The setup key is only used for configuring the server from the web console. The service needs to be restarted after setting the MongoDB URI from the CLI.

---

<div class="post-metadata">

**Author:** ![ahyben](https://forum.pritunl.com/letter_avatar_proxy/v4/letter/a/71c47a/32.png) [@ahyben](https://forum.pritunl.com/u/ahyben)\
**Post date:** [April 11, 2024, 7:38am UTC](https://forum.pritunl.com/t/automation-of-setup-key/1978/3 "2024-04-11T07:38:47Z")

</div>

I restarted service, but everytime I load the pritunl page, it is redirecting me back to the page where it asks for setup-key. Therefore I think, it require this key to be inserted somewhere in config …
