1 /* 2 * radiusplugin -- An OpenVPN plugin for do radius authentication 3 * and accounting. 4 * 5 * Copyright (C) 2005 EWE TEL GmbH/Ralf Luebben <ralfluebben@gmx.de> 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation; either version 2 of the License, or 10 * any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 20 */ 21 22 #ifndef _CONFIG_H_ 23 24 #define _CONFIG_H_ 25 #include <fstream> 26 #include <iostream> 27 #include <cstring> 28 29 #include "RadiusClass/error.h" 30 31 #include <list> 32 #include <utility> 33 using namespace std; 34 35 /**This class represents the configurations attributes (without radius configuration) which 36 * can set in the configuration file and methods for the attributes. 37 */ 38 class Config 39 { 40 private: 41 42 string ccdPath; /**<The client config dir, where the plugin writes the config informations (framed routes & ip address of the client)*/ 43 string statusfile; /**< The path and filename of the status file, where openvpn writes the status information.*/ 44 char subnet[16]; /**<The subnet which is assigned to the client in topology option.*/ 45 char p2p[16]; /**<The OpenVPN server address which is assigned to the client in topology p2p.*/ 46 string vsascript; /**<A script whcih handles vendor specific attributes.*/ 47 string vsanamedpipe; /**<The named pipe to the vsascript.*/ 48 bool usernameascommonname; /**<Use the username as commonname in the plugin (for OpenVPN option username-as-common-name (no commonname in the enviroment!)).*/ 49 bool clientcertnotrequired; /**<For OpenVPN option client_cert_not_required, commonname = UNDEF.*/ 50 string openvpnconfig; /**<Path to OpenVPN config.*/ 51 bool overwriteccfiles; /**<If true the plugin overwrites the client config files.*/ 52 bool useauthcontrolfile; /**<If true and the OpenVPN version supports auth control files, the acf is used.*/ 53 54 void deletechars(string * ); 55 56 public: 57 Config(void); 58 Config(char * configfile); 59 ~Config(); 60 61 int parseConfigFile(const char * configfile); 62 63 64 65 void getValue(const char * text, char * value); 66 67 string getCcdPath(void); 68 void setCcdPath(string); 69 70 string getStatusFile(void); 71 void setStatusFile(string); 72 73 char * getSubnet(void); 74 void setSubnet(char * ); 75 76 char * getP2p(void); 77 void setP2p(char * ); 78 79 string getVsaScript(void); 80 void setVsaScript(string); 81 82 string getVsaNamedPipe(void); 83 void setVsaNamedPipe(string); 84 85 bool getUsernameAsCommonname(void); 86 void setUsernameAsCommonname(bool); 87 88 bool getClientCertNotRequired(void); 89 void setClientCertNotRequired(bool); 90 91 bool getOverWriteCCFiles(void); 92 void setOverWriteCCFiles(bool); 93 94 bool getUseAuthControlFile(void); 95 void setUseAuthControlFile(bool); 96 97 string getOpenVPNConfig(void); 98 void setOpenVPNConfig(string); 99 }; 100 101 #endif //_CONFIG_H_ 102 103