File tree Expand file tree Collapse file tree 2 files changed +88
-1
lines changed Expand file tree Collapse file tree 2 files changed +88
-1
lines changed Original file line number Diff line number Diff line change @@ -193,6 +193,11 @@ api:
193193 #- 127.0.0.1
194194 #- ::1
195195 #- 10.0.0.0/24
196+ auto_registration:
197+ enabled: <true|false>
198+ token: <string>
199+ allowed_ranges:
200+ - 10.0.0.0/24
196201prometheus:
197202 enabled: "(true|false)"
198203 level: "(full|aggregated)"
@@ -706,7 +711,11 @@ api:
706711 - bouncers_ou
707712 crl_path: "<path_to_crl_file>"
708713 cache_expiration: "<cache_duration_for_revocation_check>"
709-
714+ auto_registration:
715+ enabled: <true|false>
716+ token: <string>
717+ allowed_ranges:
718+ - 10.0.0.0/24
710719` ` `
711720
712721# ### `cti`
@@ -808,6 +817,11 @@ server:
808817 - bouncers_ou
809818 crl_path: "<path_to_crl_file>"
810819 cache_expiration: "<cache_duration_for_revocation_check>"
820+ auto_registration:
821+ enabled: <true|false>
822+ token: <string>
823+ allowed_ranges:
824+ - 10.0.0.0/24
811825` ` `
812826
813827# #### `enable`
@@ -953,6 +967,40 @@ The format must be compatible with golang [time.Duration](https://pkg.go.dev/tim
953967IPs or IP ranges which have admin access to API. The APIs would still need to have API keys.
954968127.0.0.1 and ::1 are always given admin access whether specified or not.
955969
970+ # ### `auto_registration`
971+
972+ This section configures LAPI to automatically accept new machine registrations
973+
974+ ` ` ` yaml
975+ auto_registration:
976+ enabled: <true|false>
977+ token: <string>
978+ allowed_ranges:
979+ - 10.0.0.0/24
980+ ` ` `
981+
982+ # #### `enabled`
983+ > bool
984+
985+ Whether automatic registration should be enabled.
986+
987+ Defaults to `false`.
988+
989+ # #### `token`
990+ > string
991+
992+ Token that should be passed in the registration request if LAPI needs to automatically validate the machine.
993+
994+ It must be at least 32 chars, and is mandatory if the feature is enabled.
995+
996+ # #### `allowed_ranges`
997+ > []string
998+
999+ IP ranges that are allowed to use the auto registration features.
1000+
1001+ It must have at least one entry if the feature is enabled
1002+
1003+
9561004# ## `prometheus`
9571005
9581006This section is used by local API and crowdsec.
Original file line number Diff line number Diff line change @@ -101,3 +101,42 @@ import CodeBlock from '@theme/CodeBlock';
101101 </TabItem >
102102
103103</Tabs >
104+
105+ ### Machine auto validation
106+
107+ :::warning
108+
109+ If you enabled this feature, make sure to restrict the IP ranges as much as possible.
110+
111+ Any rogue machine registered in your LAPI will be able to push arbitrary alerts, and potentially lock you out.
112+
113+ :::
114+
115+ In some situation, it's not practical to manually create or validate new machines in LAPI (eg, when running in an environment that uses auto-scaling).
116+
117+ It is possible to configure LAPI to automatically accept new machines upon creation with the ` api.server.auto_registration ` section:
118+
119+ ``` yaml
120+ api :
121+ server :
122+ auto_registration :
123+ enabled : true
124+ token : " long_token_that_is_at_least_32_characters_long"
125+ allowed_ranges :
126+ - 10.2.0.42/32
127+ - 10.0.0.0/24
128+ ` ` `
129+
130+ You have to specify both the ` token` and `allowed_ranges`.
131+
132+ Once the configuration is done, you can pass the token to your registration request with the `--token` parameter :
133+
134+ ` ` ` bash
135+ cscli lapi register --machine my_machine --token long_token_that_is_at_least_32_characters_long
136+ ` ` `
137+
138+ If the token is valid and the request is coming from an authorized IP range, LAPI will automatically validate the machine and it will be able to login without any further configuration.
139+
140+ If no token is sent, LAPI will treat the request as a normal registration, regardless of the configuration.
141+
142+ If a token is set but invalid, the request will be refused.
You can’t perform that action at this time.
0 commit comments