Skip to content

Commit 546d573

Browse files
committed
Changed authserial to enabled by default.
Added mtaserver.conf IP exceptions option for auth serial http protection. Added mtaserver.conf owner email address option.
1 parent fe0d97c commit 546d573

File tree

5 files changed

+38
-5
lines changed

5 files changed

+38
-5
lines changed

Server/mods/deathmatch/logic/CAccountManager.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -997,6 +997,7 @@ bool CAccountManager::IsAuthorizedSerialRequired( CAccount* pAccount )
997997
bool CAccountManager::IsHttpLoginAllowed( CAccount* pAccount, const SString& strIp )
998998
{
999999
if ( !g_pGame->GetConfig()->GetAuthSerialHttpEnabled() ||
1000+
g_pGame->GetConfig()->IsAuthSerialHttpIpException(strIp) ||
10001001
!IsAuthorizedSerialRequired( pAccount ) ||
10011002
pAccount->IsIpAuthorized( strIp ) )
10021003
{

Server/mods/deathmatch/logic/CMainConfig.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -499,8 +499,8 @@ bool CMainConfig::Load ( void )
499499
SString strGroupList;
500500
if ( GetString( m_pRootNode, "auth_serial_groups", strGroupList, 1 ) != IS_SUCCESS )
501501
{
502-
// If not defined in conf file, then default to disabled
503-
strGroupList = "";
502+
// If not defined in conf file, then default to Admin
503+
strGroupList = "Admin";
504504
}
505505
ReadCommaSeparatedList(strGroupList, m_AuthSerialGroupList);
506506

@@ -510,6 +510,16 @@ bool CMainConfig::Load ( void )
510510
m_bAuthSerialHttpEnabled = true;
511511
}
512512

513+
// auth_serial_http_ip_exceptions
514+
SString strIpsString;
515+
GetString(m_pRootNode, "auth_serial_http_ip_exceptions", strIpsString);
516+
ReadCommaSeparatedList(strIpsString, m_AuthSerialHttpIpExceptionList);
517+
518+
// owner_email_address
519+
SString strEmailsString;
520+
GetString(m_pRootNode, "owner_email_address", strEmailsString);
521+
ReadCommaSeparatedList(strEmailsString, m_OwnerEmailAddressList);
522+
513523
// Check settings in this list here
514524
const std::vector < SIntSetting >& settingList = GetIntSettingList ();
515525
for ( uint i = 0 ; i < settingList.size () ; i++ )

Server/mods/deathmatch/logic/CMainConfig.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,12 @@ class CMainConfig: public CXMLConfig
125125
bool GetCrashDumpUploadEnabled ( void ) const { return m_bCrashDumpUploadEnabled != 0; }
126126
bool GetFilterDuplicateLogLinesEnabled ( void ) const { return m_bFilterDuplicateLogLinesEnabled != 0; }
127127
bool IsAuthSerialGroup ( const SString& strGroup ) const { return ListContains ( m_AuthSerialGroupList, strGroup ); };
128+
bool IsAuthSerialHttpIpException ( const SString& strIp ) const { return ListContains ( m_AuthSerialHttpIpExceptionList, strIp ); }
128129
bool GetAuthSerialEnabled ( void ) const { return !m_AuthSerialGroupList.empty(); };
129130
bool GetAuthSerialHttpEnabled ( void ) const { return m_bAuthSerialHttpEnabled && GetAuthSerialEnabled(); };
130131
const std::vector< SString >& GetAuthSerialGroupList ( void ) const { return m_AuthSerialGroupList; }
132+
const std::vector< SString >& GetAuthSerialHttpIpExceptionList( void ) const { return m_AuthSerialHttpIpExceptionList; }
133+
const std::vector< SString >& GetOwnerEmailAddressList ( void ) const { return m_OwnerEmailAddressList; }
131134
bool IsDatabaseCredentialsProtectionEnabled ( void ) const { return m_bDatabaseCredentialsProtectionEnabled != 0; }
132135
bool IsFakeLagCommandEnabled ( void ) const { return m_bFakeLagCommandEnabled != 0; }
133136

@@ -193,6 +196,8 @@ class CMainConfig: public CXMLConfig
193196
std::set < SString > m_EnableDiagnosticMap;
194197
std::vector < SString > m_AuthSerialGroupList;
195198
bool m_bAuthSerialHttpEnabled;
199+
std::vector<SString> m_AuthSerialHttpIpExceptionList;
200+
std::vector<SString> m_OwnerEmailAddressList;
196201
SString m_strMinClientVersion;
197202
SString m_strRecommendedClientVersion;
198203
SString m_strIdFile;

Server/mods/deathmatch/mtaserver.conf

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44
and on Game-Monitor. It is a required parameter. -->
55
<servername>Default MTA Server</servername>
66

7+
<!-- This parameter specifies the contact email addresses for the owner(s) of this server.
8+
Note: Missing or incorrect owner_email_address can affect your server list position.
9+
Values: Comma separated list of email addresses -->
10+
<owner_email_address></owner_email_address>
11+
712
<!-- ONLY USE THIS PARAMETER IF YOU ARE SURE OF WHAT YOU ARE DOING - it is generally only
813
needed for professional servers and should be left at the default value otherwise.
914
This parameter specifies the IP to use for servers that have multiple IP addresses. If set
@@ -44,9 +49,9 @@
4449
e.g. 88.11.22.33,101.2.3.4 -->
4550
<http_dos_exclude></http_dos_exclude>
4651

47-
<!-- By default, the server will block the use of locally customized gta3.img player skins and vehicles
52+
<!-- By default, the server will block the use of locally customized gta3.img player skins
4853
This setting can be used to allow such mods. Not recommended for competitive servers.
49-
Values: none, peds, vehicles ; default value: none -->
54+
Values: none, peds ; default value: none -->
5055
<allow_gta3_img_mods>none</allow_gta3_img_mods>
5156

5257
<!-- By default, the server will block the use of customized GTA:SA data files. -->
@@ -230,16 +235,22 @@
230235
Login attempts to a protected account from a second serial are blocked until the serial is manually authorized via
231236
the authserial command.
232237
For more info see: https://mtasa.com/authserial
238+
Note: Disabling auth_serial_groups can affect your server list position.
233239
Values: Comma separated list of ACL groups. Default - Admin -->
234240
<auth_serial_groups>Admin</auth_serial_groups>
235241

236242
<!-- This parameter specifies if the authorized serial login checks should also apply to the http interface.
237243
Protected account login attempts to the http interface will only succeed if the IP address matches one
238244
recently used by the account holder in-game
239245
For more info see: https://mtasa.com/authserialhttp
246+
Note: Disabling auth_serial_http can affect your server list position.
240247
Values: 0 - Off, 1 - Enabled. Default - 1 -->
241248
<auth_serial_http>1</auth_serial_http>
242249

250+
<!-- This parameter specifies which IP addresses should always pass auth_serial_http checks.
251+
Values: Comma separated list of IP addresses -->
252+
<auth_serial_http_ip_exceptions>127.0.0.1</auth_serial_http_ip_exceptions>
253+
243254
<!-- This parameter specifies if extra security measures are applied to resources which use dbConnect with mysql.
244255
The extra measures are:
245256
- Script files cannot be accessed with fileOpen()

Server/mods/deathmatch/utils/CHqComms.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class CHqComms : public CRefCountable
4545
m_Stage = HQCOMMS_STAGE_QUERY;
4646

4747
CBitStream bitStream;
48-
bitStream->Write( (char)3 ); // Data version
48+
bitStream->Write( (char)4 ); // Data version
4949
bitStream->WriteStr( g_pGame->GetConfig()->GetServerIP() );
5050
bitStream->Write( g_pGame->GetConfig()->GetServerPort() );
5151
bitStream->WriteStr( CStaticFunctionDefinitions::GetVersionSortable() );
@@ -80,6 +80,12 @@ class CHqComms : public CRefCountable
8080
bitStream->WriteStr( MTA_OS_STRING );
8181
bitStream->WriteStr( g_pGame->GetConfig()->GetServerIPList() );
8282

83+
bitStream->Write( g_pGame->GetConfig()->IsDatabaseCredentialsProtectionEnabled() ? 1 : 0 );
84+
bitStream->Write( g_pGame->GetConfig()->IsFakeLagCommandEnabled() ? 1 : 0 );
85+
bitStream->Write( g_pGame->GetConfig()->GetAuthSerialHttpEnabled() ? 1 : 0 );
86+
bitStream->WriteStr( SString::Join(",", g_pGame->GetConfig()->GetAuthSerialGroupList()) );
87+
bitStream->WriteStr( SString::Join(",", g_pGame->GetConfig()->GetOwnerEmailAddressList()) );
88+
8389
// Send request
8490
this->AddRef(); // Keep object alive
8591
GetDownloadManager()->QueueFile( m_strURL, NULL, 0, (const char*)bitStream->GetData(), bitStream->GetNumberOfBytesUsed(), true, this, StaticDownloadFinishedCallback, false, 2 );

0 commit comments

Comments
 (0)