mirror of
				https://github.com/osmarks/ngircd.git
				synced 2025-10-31 14:02:59 +00:00 
			
		
		
		
	Merge branch 'MorePrivacy'
* MorePrivacy: New configuration opion "MorePrivacy" to "censor" some user information
This commit is contained in:
		| @@ -142,6 +142,10 @@ | |||||||
| 	# Do IDENT lookups if ngIRCd has been compiled with support for it. | 	# Do IDENT lookups if ngIRCd has been compiled with support for it. | ||||||
| 	;Ident = yes | 	;Ident = yes | ||||||
|  |  | ||||||
|  | 	# Enhance user privacy slightly (useful for IRC server on TOR or I2P) | ||||||
|  | 	# by censoring some information like idle time, logon time, etc. | ||||||
|  | 	;MorePrivacy = no | ||||||
|  |  | ||||||
| 	# Normally ngIRCd doesn't send any messages to a client until it is | 	# Normally ngIRCd doesn't send any messages to a client until it is | ||||||
| 	# registered. Enable this option to let the daemon send "NOTICE AUTH" | 	# registered. Enable this option to let the daemon send "NOTICE AUTH" | ||||||
| 	# messages to clients while connecting. | 	# messages to clients while connecting. | ||||||
|   | |||||||
| @@ -246,6 +246,15 @@ If ngIRCd is compiled with IDENT support this can be used to disable IDENT | |||||||
| lookups at run time. | lookups at run time. | ||||||
| Default: yes. | Default: yes. | ||||||
| .TP | .TP | ||||||
|  | \fBMorePrivacy\fR (boolean) | ||||||
|  | This will cause ngIRCd to censor user idle time, logon time as well as the | ||||||
|  | part/quit messages (that are sometimes used to inform everyone about which | ||||||
|  | client software is being used). WHOWAS requests are also silently ignored. | ||||||
|  | This option is most useful when ngIRCd is being used together with | ||||||
|  | anonymizing software such as TOR or I2P and one does not wish to make it | ||||||
|  | too easy to collect statistics on the users. | ||||||
|  | Default: no. | ||||||
|  | .TP | ||||||
| \fBNoticeAuth\fR (boolean) | \fBNoticeAuth\fR (boolean) | ||||||
| Normally ngIRCd doesn't send any messages to a client until it is registered. | Normally ngIRCd doesn't send any messages to a client until it is registered. | ||||||
| Enable this option to let the daemon send "NOTICE AUTH" messages to clients | Enable this option to let the daemon send "NOTICE AUTH" messages to clients | ||||||
|   | |||||||
| @@ -263,6 +263,9 @@ Channel_Part(CLIENT * Client, CLIENT * Origin, const char *Name, const char *Rea | |||||||
| 		return false; | 		return false; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | 	if (Conf_MorePrivacy) | ||||||
|  | 		Reason = ""; | ||||||
|  |  | ||||||
| 	/* Part client from channel */ | 	/* Part client from channel */ | ||||||
| 	if (!Remove_Client(REMOVE_PART, chan, Client, Origin, Reason, true)) | 	if (!Remove_Client(REMOVE_PART, chan, Client, Origin, Reason, true)) | ||||||
| 		return false; | 		return false; | ||||||
| @@ -331,6 +334,9 @@ Channel_Quit( CLIENT *Client, const char *Reason ) | |||||||
| 	assert( Client != NULL ); | 	assert( Client != NULL ); | ||||||
| 	assert( Reason != NULL ); | 	assert( Reason != NULL ); | ||||||
|  |  | ||||||
|  | 	if (Conf_MorePrivacy) | ||||||
|  | 		Reason = ""; | ||||||
|  |  | ||||||
| 	IRC_WriteStrRelatedPrefix( Client, Client, false, "QUIT :%s", Reason ); | 	IRC_WriteStrRelatedPrefix( Client, Client, false, "QUIT :%s", Reason ); | ||||||
|  |  | ||||||
| 	c = My_Channels; | 	c = My_Channels; | ||||||
| @@ -961,6 +967,9 @@ Remove_Client( int Type, CHANNEL *Chan, CLIENT *Client, CLIENT *Origin, const ch | |||||||
| 				Client_Mask( Client ), c->name, Client_ID(Origin), Reason); | 				Client_Mask( Client ), c->name, Client_ID(Origin), Reason); | ||||||
| 			break; | 			break; | ||||||
| 		default: /* PART */ | 		default: /* PART */ | ||||||
|  | 			if (Conf_MorePrivacy) | ||||||
|  | 				Reason = ""; | ||||||
|  |  | ||||||
| 			if (InformServer) | 			if (InformServer) | ||||||
| 				IRC_WriteStrServersPrefix(Origin, Client, "PART %s :%s", c->name, Reason); | 				IRC_WriteStrServersPrefix(Origin, Client, "PART %s :%s", c->name, Reason); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -335,8 +335,10 @@ Client_SetID( CLIENT *Client, const char *ID ) | |||||||
| 	 | 	 | ||||||
| 	strlcpy( Client->id, ID, sizeof( Client->id )); | 	strlcpy( Client->id, ID, sizeof( Client->id )); | ||||||
|  |  | ||||||
| 	if (Conf_CloakUserToNick) | 	if (Conf_CloakUserToNick) { | ||||||
| 		strlcpy( Client->user, ID, sizeof( Client->user )); | 		strlcpy( Client->user, ID, sizeof( Client->user )); | ||||||
|  | 		strlcpy( Client->info, ID, sizeof( Client->info )); | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	/* Hash */ | 	/* Hash */ | ||||||
| 	Client->hash = Hash( Client->id ); | 	Client->hash = Hash( Client->id ); | ||||||
| @@ -351,9 +353,9 @@ Client_SetUser( CLIENT *Client, const char *User, bool Idented ) | |||||||
| 	assert( Client != NULL ); | 	assert( Client != NULL ); | ||||||
| 	assert( User != NULL ); | 	assert( User != NULL ); | ||||||
|  |  | ||||||
| 	if (Conf_CloakUserToNick) return; | 	if (Conf_CloakUserToNick) { | ||||||
|  | 		strlcpy(Client->user, Client->id, sizeof(Client->user)); | ||||||
| 	if (Idented) { | 	} else if (Idented) { | ||||||
| 		strlcpy(Client->user, User, sizeof(Client->user)); | 		strlcpy(Client->user, User, sizeof(Client->user)); | ||||||
| 	} else { | 	} else { | ||||||
| 		Client->user[0] = '~'; | 		Client->user[0] = '~'; | ||||||
| @@ -390,6 +392,9 @@ Client_SetInfo( CLIENT *Client, const char *Info ) | |||||||
| 	assert( Client != NULL ); | 	assert( Client != NULL ); | ||||||
| 	assert( Info != NULL ); | 	assert( Info != NULL ); | ||||||
|  |  | ||||||
|  | 	if (Conf_CloakUserToNick) | ||||||
|  | 		strlcpy(Client->info, Client->id, sizeof(Client->info)); | ||||||
|  | 	else | ||||||
| 		strlcpy(Client->info, Info, sizeof(Client->info)); | 		strlcpy(Client->info, Info, sizeof(Client->info)); | ||||||
| } /* Client_SetInfo */ | } /* Client_SetInfo */ | ||||||
|  |  | ||||||
|   | |||||||
| @@ -369,6 +369,7 @@ Conf_Test( void ) | |||||||
| #ifdef IDENT | #ifdef IDENT | ||||||
| 	printf("  Ident = %s\n", yesno_to_str(Conf_Ident)); | 	printf("  Ident = %s\n", yesno_to_str(Conf_Ident)); | ||||||
| #endif | #endif | ||||||
|  | 	printf("  MorePrivacy = %s\n", yesno_to_str(Conf_MorePrivacy)); | ||||||
| 	printf("  NoticeAuth = %s\n", yesno_to_str(Conf_NoticeAuth)); | 	printf("  NoticeAuth = %s\n", yesno_to_str(Conf_NoticeAuth)); | ||||||
| 	printf("  OperCanUseMode = %s\n", yesno_to_str(Conf_OperCanMode)); | 	printf("  OperCanUseMode = %s\n", yesno_to_str(Conf_OperCanMode)); | ||||||
| 	printf("  OperServerMode = %s\n", yesno_to_str(Conf_OperServerMode)); | 	printf("  OperServerMode = %s\n", yesno_to_str(Conf_OperServerMode)); | ||||||
| @@ -689,6 +690,7 @@ Set_Defaults(bool InitServers) | |||||||
| #else | #else | ||||||
| 	Conf_Ident = false; | 	Conf_Ident = false; | ||||||
| #endif | #endif | ||||||
|  | 	Conf_MorePrivacy = false; | ||||||
| 	Conf_NoticeAuth = false; | 	Conf_NoticeAuth = false; | ||||||
| 	Conf_OperCanMode = false; | 	Conf_OperCanMode = false; | ||||||
| 	Conf_OperServerMode = false; | 	Conf_OperServerMode = false; | ||||||
| @@ -1460,6 +1462,10 @@ Handle_OPTIONS(int Line, char *Var, char *Arg) | |||||||
| 		WarnIdent(Line); | 		WarnIdent(Line); | ||||||
| 		return; | 		return; | ||||||
| 	} | 	} | ||||||
|  | 	if (strcasecmp(Var, "MorePrivacy") == 0) { | ||||||
|  | 		Conf_MorePrivacy = Check_ArgIsTrue(Arg); | ||||||
|  | 		return; | ||||||
|  | 	} | ||||||
| 	if (strcasecmp(Var, "NoticeAuth") == 0) { | 	if (strcasecmp(Var, "NoticeAuth") == 0) { | ||||||
| 		Conf_NoticeAuth = Check_ArgIsTrue(Arg); | 		Conf_NoticeAuth = Check_ArgIsTrue(Arg); | ||||||
| 		return; | 		return; | ||||||
|   | |||||||
| @@ -175,15 +175,18 @@ GLOBAL bool Conf_DNS; | |||||||
| /** Enable IDENT lookups, even when compiled with support for it */ | /** Enable IDENT lookups, even when compiled with support for it */ | ||||||
| GLOBAL bool Conf_Ident; | GLOBAL bool Conf_Ident; | ||||||
|  |  | ||||||
|  | /** Enable "more privacy" mode and "censor" some user-related information */ | ||||||
|  | GLOBAL bool Conf_MorePrivacy; | ||||||
|  |  | ||||||
|  | /** Enable NOTICE AUTH messages on connect */ | ||||||
|  | GLOBAL bool Conf_NoticeAuth; | ||||||
|  |  | ||||||
| /** Enable all usage of PAM, even when compiled with support for it */ | /** Enable all usage of PAM, even when compiled with support for it */ | ||||||
| GLOBAL bool Conf_PAM; | GLOBAL bool Conf_PAM; | ||||||
|  |  | ||||||
| /** Disable all CTCP commands except for /me ? */ | /** Disable all CTCP commands except for /me ? */ | ||||||
| GLOBAL bool Conf_ScrubCTCP; | GLOBAL bool Conf_ScrubCTCP; | ||||||
|  |  | ||||||
| /** Enable NOTICE AUTH messages on connect */ |  | ||||||
| GLOBAL bool Conf_NoticeAuth; |  | ||||||
|  |  | ||||||
| /* | /* | ||||||
|  * try to connect to remote systems using the ipv6 protocol, |  * try to connect to remote systems using the ipv6 protocol, | ||||||
|  * if they have an ipv6 address? (default yes) |  * if they have an ipv6 address? (default yes) | ||||||
|   | |||||||
| @@ -999,7 +999,7 @@ IRC_WHOIS_SendReply(CLIENT *Client, CLIENT *from, CLIENT *c) | |||||||
| 			return DISCONNECTED; | 			return DISCONNECTED; | ||||||
|  |  | ||||||
| 	/* Idle and signon time (local clients only!) */ | 	/* Idle and signon time (local clients only!) */ | ||||||
| 	if (Client_Conn(c) > NONE && | 	if (!Conf_MorePrivacy && Client_Conn(c) > NONE && | ||||||
| 		!IRC_WriteStrClient(from, RPL_WHOISIDLE_MSG, | 		!IRC_WriteStrClient(from, RPL_WHOISIDLE_MSG, | ||||||
| 				    Client_ID(from), Client_ID(c), | 				    Client_ID(from), Client_ID(c), | ||||||
| 				    (unsigned long)Conn_GetIdle(Client_Conn(c)), | 				    (unsigned long)Conn_GetIdle(Client_Conn(c)), | ||||||
| @@ -1163,6 +1163,10 @@ IRC_WHOWAS( CLIENT *Client, REQUEST *Req ) | |||||||
| 	assert( Client != NULL ); | 	assert( Client != NULL ); | ||||||
| 	assert( Req != NULL ); | 	assert( Req != NULL ); | ||||||
|  |  | ||||||
|  | 	/* Do not reveal any info on disconnected users? */ | ||||||
|  | 	if (Conf_MorePrivacy) | ||||||
|  | 		return CONNECTED; | ||||||
|  |  | ||||||
| 	/* Wrong number of parameters? */ | 	/* Wrong number of parameters? */ | ||||||
| 	if (Req->argc > 3) | 	if (Req->argc > 3) | ||||||
| 		return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG, | 		return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG, | ||||||
| @@ -1389,6 +1393,10 @@ IRC_Send_NAMES( CLIENT *Client, CHANNEL *Chan ) | |||||||
| 	if( Channel_IsMemberOf( Chan, Client )) is_member = true; | 	if( Channel_IsMemberOf( Chan, Client )) is_member = true; | ||||||
| 	else is_member = false; | 	else is_member = false; | ||||||
|  |  | ||||||
|  | 	/* Do not print info on channel memberships to anyone that is not member? */ | ||||||
|  | 	if (Conf_MorePrivacy && !is_member) | ||||||
|  | 		return CONNECTED; | ||||||
|  |  | ||||||
| 	/* Secret channel? */ | 	/* Secret channel? */ | ||||||
| 	if( ! is_member && strchr( Channel_Modes( Chan ), 's' )) return CONNECTED; | 	if( ! is_member && strchr( Channel_Modes( Chan ), 's' )) return CONNECTED; | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Alexander Barton
					Alexander Barton