OPNsense
  • Home
  • Help
  • Search
  • Login
  • Register

  • OPNsense Forum »
  • English Forums »
  • General Discussion »
  • Adding 400 users to local user manager
« previous next »
  • Print
Pages: 1 [2]

Author Topic: Adding 400 users to local user manager  (Read 12166 times)

Wyrm

  • Jr. Member
  • **
  • Posts: 56
  • Karma: 1
    • View Profile
Re: Adding 400 users to local user manager
« Reply #15 on: September 03, 2018, 09:45:46 pm »
Quote from: fabian on September 03, 2018, 09:22:10 pm
a simple shell script adding one per row?
cat file.csv | while read line; do
c1=$(echo $line | cut -d',' -f1)
...
curl ... -H "Content-Type: application/json" --data "{json data}"
done;
I am sorry I do not much understand...I have .csv file and format of every row is:
username;e-mail;password;fullname
How will look whole script or where is command to add user?

I have PowerShell module by fvanroie and it only now connects to opnsense server by using api key and secret. Script he posted here is not adding any users. I tried to modify .csv file to only have password and username there and it did not helped.

So i do not know how to do it exactly...

Logged

fabian

  • Hero Member
  • *****
  • Posts: 2769
  • Karma: 200
  • OPNsense Contributor (Language, VPN, Proxy, etc.)
    • View Profile
    • Personal Homepage
Re: Adding 400 users to local user manager
« Reply #16 on: September 03, 2018, 10:23:35 pm »
Quote from: Wyrm on September 03, 2018, 09:45:46 pm
I am sorry I do not much understand...I have .csv file and format of every row is:
username;e-mail;password;fullname
username=$(echo $line | cut -d';' -f1)
mail=$(echo $line | cut -d';' -f2)
password=$(echo $line | cut -d';' -f3)
fullname=$(echo $line | cut -d';' -f4)

data extract from line is done - the rest is posting using curl. However this is shell scripting (Linux/BSD) and not Powershell.
the curl command only needs -u "user:password" (the two access token values) and the correct JSON structure like mentioned ealier.

Quote from: Wyrm on September 03, 2018, 09:45:46 pm
How will look whole script or where is command to add user?

I think you can assemble the parts now ;)

Quote from: Wyrm on September 03, 2018, 09:45:46 pm
I have PowerShell module by fvanroie and it only now connects to opnsense server by using api key and secret. Script he posted here is not adding any users. I tried to modify .csv file to only have password and username there and it did not helped.

Mine is just a small hint for you to get it done :)
for example, instead of curl you can output the variable using echo $username to see the content. The JSON structure can be captured from the web interface (it is using the same api)
Logged

Wyrm

  • Jr. Member
  • **
  • Posts: 56
  • Karma: 1
    • View Profile
Re: Adding 400 users to local user manager
« Reply #17 on: September 04, 2018, 01:06:28 am »
Is it usable for local system manager users?
Logged

mimugmail

  • Hero Member
  • *****
  • Posts: 6767
  • Karma: 494
    • View Profile
Re: Adding 400 users to local user manager
« Reply #18 on: September 04, 2018, 06:01:45 am »
Quote from: Wyrm on September 04, 2018, 01:06:28 am
Is it usable for local system manager users?

No, only with Freeradius plugin.
What exactly do you want to achieve with these local users?
Logged
WWW: www.routerperformance.net
Support plans: https://www.max-it.de/en/it-services/opnsense/
Commercial Plugins (German): https://opnsense.max-it.de/

Wyrm

  • Jr. Member
  • **
  • Posts: 56
  • Karma: 1
    • View Profile
Re: Adding 400 users to local user manager
« Reply #19 on: September 04, 2018, 08:10:48 am »
I need them to login to captive portal and later for more services.
They also will have access to gui to change passwords and other aspects.
Customer does not have any windows server to hold their users and need to use these users to connect to his wifi and needs to apply some filtering and proxy
I think is better to have them as local users because when they decide to use 2FA they could...

By shell is possible to add them by some batch ?
« Last Edit: September 04, 2018, 08:26:17 am by Wyrm »
Logged

mimugmail

  • Hero Member
  • *****
  • Posts: 6767
  • Karma: 494
    • View Profile
Re: Adding 400 users to local user manager
« Reply #20 on: September 04, 2018, 08:16:00 am »
You have to pre-check for what exactly. Also when using OpenVPN Radius can be used. Only downside would be you won't get a a client certificate for each user.

Captive Portal and OpenVPN with only user/pw is fine with Radius.
Logged
WWW: www.routerperformance.net
Support plans: https://www.max-it.de/en/it-services/opnsense/
Commercial Plugins (German): https://opnsense.max-it.de/

Wyrm

  • Jr. Member
  • **
  • Posts: 56
  • Karma: 1
    • View Profile
Re: Adding 400 users to local user manager
« Reply #21 on: September 04, 2018, 08:41:57 am »
Better is not to use Radius. In future they may need certificates, because it is school and there is now strong impact on security (EU GDPR)...
Logged

Wyrm

  • Jr. Member
  • **
  • Posts: 56
  • Karma: 1
    • View Profile
Re: Adding 400 users to local user manager
« Reply #22 on: September 04, 2018, 11:19:40 pm »
Is there some option to do by some script anything for users in local manager?
When I save configuration - it is in XML. There is part in system tree in xml and it cointaints users...
Format is like this:
<user>
      <password>password</password>
      <scope>user</scope>
      <name>name</name>
      <descr>some descript</descr>
      <expires/>
      <authorizedkeys/>
      <ipsecpsk/>
      <otp_seed/>
      <email>some@some.xx</email>
      <uid>user id number</uid>
</user>
   
So is possible to have some import option to make xml file with this structure to add users?
Logged

  • Print
Pages: 1 [2]
« previous next »
  • OPNsense Forum »
  • English Forums »
  • General Discussion »
  • Adding 400 users to local user manager
 

OPNsense is an OSS project © Deciso B.V. 2015 - 2024 All rights reserved
  • SMF 2.0.19 | SMF © 2021, Simple Machines
    Privacy Policy
    | XHTML | RSS | WAP2