Open celevra opened 3 years ago
Hello @celevra,
When you run cscli lapi register
you can give a name to your crowdsec agent with --name
flag like:
cscli lapi register -u url:port --name myMachine
is there a way to rename it? or do we have the rejoin all machines?
Currently, it is not possible to rename a machine already registered to the LAPI :disappointed:
@AlteredCoder which version is the --name
option available in please? It doesn't appear in mine (version below).
The --machine
flag doesn't have the desired effect either.
Register you machine to the Local API (LAPI).
Keep in mind the machine needs to be validated by an administrator on LAPI side to be effective.
Usage:
cscli lapi register [flags]
Flags:
-f, --file string output file destination
-h, --help help for register
--machine string Name of the machine to register with
-u, --url string URL of the API (ie. http://127.0.0.1)
Global Flags:
-c, --config string path to crowdsec config file (default "/etc/crowdsec/config.yaml")
--debug Set logging to debug.
--error Set logging to error.
--info Set logging to info.
-o, --output string Output format : human, json, raw.
--trace Set logging to trace.
--warning Set logging to warning.
2021/12/28 17:01:03 version: v1.2.1-debian-pragmatic-dd03d073558e380c283afe66942f537c3da647ff
2021/12/28 17:01:03 Codename: alphaga
2021/12/28 17:01:03 BuildDate: 2021-11-18_10:12:30
2021/12/28 17:01:03 GoVersion: 1.16.7
2021/12/28 17:01:03 Constraint_parser: >= 1.0, <= 2.0
2021/12/28 17:01:03 Constraint_scenario: >= 1.0, < 3.0
2021/12/28 17:01:03 Constraint_api: v1
2021/12/28 17:01:03 Constraint_acquis: >= 1.0, < 2.0
The --machine
flag worked for me today on FreeBSD.
2022/06/09 01:24:57 version: v1.3.4-c196ed45b62c12d9c6549da927c37c64bd08c642
2022/06/09 01:24:57 Codename: alphaga
2022/06/09 01:24:57 BuildDate: 2022-05-24_04:09:55
2022/06/09 01:24:57 GoVersion: 1.18.2
2022/06/09 01:24:57 Platform: freebsd
2022/06/09 01:24:57 Constraint_parser: >= 1.0, <= 2.0
2022/06/09 01:24:57 Constraint_scenario: >= 1.0, < 3.0
2022/06/09 01:24:57 Constraint_api: v1
2022/06/09 01:24:57 Constraint_acquis: >= 1.0, < 2.0
For anyone else arriving here: https://docs.crowdsec.net/docs/user_guides/machines_mgmt/#machine-register
HI, is renaming still not possible? I am using Docker compose and the machine is named 'localhost'. When I receive email and slack notifications it would be nice to see which host they came from. Any workaround for this?
HI, is renaming still not possible? I am using Docker compose and the machine is named 'localhost'. When I receive email and slack notifications it would be nice to see which host they came from. Any workaround for this?
If you are using docker compose you can use the environment variable called CUSTOM_HOSTNAME
to set the name
CUSTOM_HOSTNAME | localhost | Name for the local agent (running in the container with LAPI)
@vitobotta
@LaurenceJJones Hi! and thanks for the quick response. What if the machine is already registered?
@vitobotta Depends what you mean by already "registered". If the machine only talks to itself, on the latest version (1.4.5) it will re register itself under the new name.
Looks like it worked! I just recreated the container with compose, it registered a machine with the custom name, then I just deleted the localhost one. Now I get notifications with the custom hostname. Thanks!
An alternative is to change the name in the local_api_credentials.yaml file and in the database (machines table).
Afterwards restart crowdsec of course...
So, non-docker, it's still not possible to rename an existing machine, without diving into the DB?
So, non-docker, it's still not possible to rename an existing machine without diving into the DB?
Not currently, as if you change the machine name, we need a way to also show the credentials, but we only store the hash. We be debating whether to have a "friendly name" which is separate from the login credentials, but this means database migrations
hi,
we have added all machines via
the get a random machineID there is no "name" or something that is in link with the ID that means the machineID and IP is the only thing to identifiy the machine
if we had created a machine account before we could have namend the System
is there a way to rename it? or do we have the rejoin all machines?
regards