We moved this page to our Documentation Portal. You can find the latest updates here. |
Question
How can I manually add whitelist IPs the command line?
Environment
OnApp 5.x and below
Answer
Here is a short guide for manually adding an IP to a whitelist of a given user.
If there is already an IP(s) in place in the whitelist, and you aren't logging in from one of those, then you'll effectively be locked out from logging in as that user.
From the database, you'll need to run the following insert command:
For example, for a user with the id 5 add the IP of 192.168.1.1:
INSERT INTO user_white_lists (user_id,ip,description,created_at,updated_at) VALUES (5,'192.168.1.1','description of ip',NOW(),NOW());
You can also add a whole subnet range by adding the /CIDR on the end of the IP like: (please keep in mind that unfortunately you can't add a range by using something like 192.168.1.1-5 )
INSERT INTO user_white_lists (user_id,ip,description,created_at,updated_at) VALUES (5,'192.168.1.1/24','description of ip',NOW(),NOW());
Additional Info
You can effectively disable Whitelist IPs for a user by adding the range 0.0.0.0/0 as a Whitelist IP. This can be useful if you would like to disable the Whitelist IP prompt for the admin users, or to enable temporary access for maintenance or testing.
INSERT INTO user_white_lists (user_id,ip,description,created_at,updated_at) VALUES (5,'0.0.0.0/0','Disables WhiteList for this User - delete to re-enable',NOW(),NOW());