3 /* Copyright (C) 2009 Trend Micro Inc.
6 * This program is a free software; you can redistribute it
7 * and/or modify it under the terms of the GNU General Public
8 * License (version 2) as published by the FSF - Free Software
12 /* Part of the OSSEC HIDS
13 * Available at http://www.ossec.net
25 #define ARGV0 "ossec-agentd"
32 /* main, v0.2, 2005/11/09
34 int main(int argc, char **argv)
39 char *dir = DEFAULTDIR;
41 char *group = GROUPGLOBAL;
47 /* Setting the name */
51 while((c = getopt(argc, argv, "Vtdhu:g:D:")) != -1){
64 ErrorExit("%s: -u needs an argument",ARGV0);
69 ErrorExit("%s: -g needs an argument",ARGV0);
77 ErrorExit("%s: -D needs an argument",ARGV0);
83 debug1(STARTED_MSG, ARGV0);
85 logr = (agent *)calloc(1, sizeof(agent));
88 ErrorExit(MEM_ERROR, ARGV0);
93 if(ClientConf(DEFAULTCPATH) < 0)
95 ErrorExit(CLIENT_ERROR,ARGV0);
100 merror(AG_INV_IP, ARGV0);
101 ErrorExit(CLIENT_ERROR,ARGV0);
105 /* Checking auth keys */
108 ErrorExit(AG_NOKEYS_EXIT, ARGV0);
112 /* Check if the user/group given are valid */
113 uid = Privsep_GetUser(user);
114 gid = Privsep_GetGroup(group);
115 if((uid < 0)||(gid < 0))
117 ErrorExit(USER_ERROR,ARGV0,user,group);
122 /* Exit if test config */
127 /* Starting the signal manipulation */
132 AgentdStart(dir, uid, gid, user, group);