Skip to content
Snippets Groups Projects
Commit b2f7561a authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Add configurable SFTP session inactivity timer (default: 5 minutes)

Allow SFTP support to be enabled/configured in SCFG->Servers and
SBBSCTRL->Terminal->Configure.

SFTP session inactivity applies to 'H' exempt users too (intentionally).
parent 824a30f9
Branches
Tags
No related merge requests found
...@@ -447,6 +447,7 @@ bool sbbs_t::answer() ...@@ -447,6 +447,7 @@ bool sbbs_t::answer()
snprintf(str, sizeof(str), "(%04u) %-25s %s Logon" snprintf(str, sizeof(str), "(%04u) %-25s %s Logon"
,useron.number, useron.alias, client.protocol); ,useron.number, useron.alias, client.protocol);
logline("++", str); logline("++", str);
max_socket_inactivity = startup->max_sftp_inactivity;
} }
else { else {
lprintf(LOG_NOTICE, "%04d Trying to create new user over sftp, disconnecting.", client_socket); lprintf(LOG_NOTICE, "%04d Trying to create new user over sftp, disconnecting.", client_socket);
...@@ -778,6 +779,7 @@ bool sbbs_t::answer() ...@@ -778,6 +779,7 @@ bool sbbs_t::answer()
if(useron.pass[0]) if(useron.pass[0])
loginSuccess(startup->login_attempt_list, &client_addr); loginSuccess(startup->login_attempt_list, &client_addr);
max_socket_inactivity = startup->max_session_inactivity; if(!term_output_disabled)
max_socket_inactivity = startup->max_session_inactivity;
return(true); return(true);
} }
...@@ -63,6 +63,7 @@ void __fastcall TTelnetCfgDlg::FormShow(TObject *Sender) ...@@ -63,6 +63,7 @@ void __fastcall TTelnetCfgDlg::FormShow(TObject *Sender)
SshInterfaceEdit->Text=AnsiString(str); SshInterfaceEdit->Text=AnsiString(str);
} }
SshConnTimeoutEdit->Text = duration_to_str(MainForm->bbs_startup.ssh_connect_timeout, str, sizeof str); SshConnTimeoutEdit->Text = duration_to_str(MainForm->bbs_startup.ssh_connect_timeout, str, sizeof str);
SFTPMaxInactivityEdit->Text = duration_to_str(MainForm->bbs_startup.max_sftp_inactivity, str, sizeof str);
TelnetPortEdit->Text=AnsiString((int)MainForm->bbs_startup.telnet_port); TelnetPortEdit->Text=AnsiString((int)MainForm->bbs_startup.telnet_port);
RLoginPortEdit->Text=AnsiString((int)MainForm->bbs_startup.rlogin_port); RLoginPortEdit->Text=AnsiString((int)MainForm->bbs_startup.rlogin_port);
...@@ -89,6 +90,8 @@ void __fastcall TTelnetCfgDlg::FormShow(TObject *Sender) ...@@ -89,6 +90,8 @@ void __fastcall TTelnetCfgDlg::FormShow(TObject *Sender)
=MainForm->bbs_startup.options&BBS_OPT_ALLOW_RLOGIN; =MainForm->bbs_startup.options&BBS_OPT_ALLOW_RLOGIN;
SshEnabledCheckBox->Checked SshEnabledCheckBox->Checked
=MainForm->bbs_startup.options&BBS_OPT_ALLOW_SSH; =MainForm->bbs_startup.options&BBS_OPT_ALLOW_SSH;
SFTPEnabledCheckBox->Checked
=MainForm->bbs_startup.options&BBS_OPT_ALLOW_SFTP;
QWKEventsCheckBox->Checked QWKEventsCheckBox->Checked
=!(MainForm->bbs_startup.options&BBS_OPT_NO_QWK_EVENTS); =!(MainForm->bbs_startup.options&BBS_OPT_NO_QWK_EVENTS);
...@@ -114,6 +117,7 @@ void __fastcall TTelnetCfgDlg::OKBtnClick(TObject *Sender) ...@@ -114,6 +117,7 @@ void __fastcall TTelnetCfgDlg::OKBtnClick(TObject *Sender)
iniFreeStringList(MainForm->bbs_startup.ssh_interfaces); iniFreeStringList(MainForm->bbs_startup.ssh_interfaces);
MainForm->bbs_startup.ssh_interfaces = strListSplitCopy(NULL, SshInterfaceEdit->Text.c_str(), ","); MainForm->bbs_startup.ssh_interfaces = strListSplitCopy(NULL, SshInterfaceEdit->Text.c_str(), ",");
MainForm->bbs_startup.ssh_connect_timeout = parse_duration(SshConnTimeoutEdit->Text.c_str()); MainForm->bbs_startup.ssh_connect_timeout = parse_duration(SshConnTimeoutEdit->Text.c_str());
MainForm->bbs_startup.max_sftp_inactivity = parse_duration(SFTPMaxInactivityEdit->Text.c_str());
MainForm->bbs_startup.telnet_port=TelnetPortEdit->Text.ToIntDef(23); MainForm->bbs_startup.telnet_port=TelnetPortEdit->Text.ToIntDef(23);
MainForm->bbs_startup.rlogin_port=RLoginPortEdit->Text.ToIntDef(513); MainForm->bbs_startup.rlogin_port=RLoginPortEdit->Text.ToIntDef(513);
...@@ -168,6 +172,11 @@ void __fastcall TTelnetCfgDlg::OKBtnClick(TObject *Sender) ...@@ -168,6 +172,11 @@ void __fastcall TTelnetCfgDlg::OKBtnClick(TObject *Sender)
else else
MainForm->bbs_startup.options&=~BBS_OPT_ALLOW_SSH; MainForm->bbs_startup.options&=~BBS_OPT_ALLOW_SSH;
if(SFTPEnabledCheckBox->Checked==true)
MainForm->bbs_startup.options|=BBS_OPT_ALLOW_SFTP;
else
MainForm->bbs_startup.options&=~BBS_OPT_ALLOW_SFTP;
MainForm->EventsLogFile = EventsLogFileCheckBox->Checked; MainForm->EventsLogFile = EventsLogFileCheckBox->Checked;
MainForm->SaveIniSettings(Sender); MainForm->SaveIniSettings(Sender);
} }
......
...@@ -3,8 +3,8 @@ object TelnetCfgDlg: TTelnetCfgDlg ...@@ -3,8 +3,8 @@ object TelnetCfgDlg: TTelnetCfgDlg
Top = 475 Top = 475
BorderStyle = bsDialog BorderStyle = bsDialog
Caption = 'Terminal Server Configuration' Caption = 'Terminal Server Configuration'
ClientHeight = 234 ClientHeight = 270
ClientWidth = 286 ClientWidth = 330
Color = clBtnFace Color = clBtnFace
Font.Charset = DEFAULT_CHARSET Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText Font.Color = clWindowText
...@@ -15,46 +15,46 @@ object TelnetCfgDlg: TTelnetCfgDlg ...@@ -15,46 +15,46 @@ object TelnetCfgDlg: TTelnetCfgDlg
Position = poScreenCenter Position = poScreenCenter
OnShow = FormShow OnShow = FormShow
PixelsPerInch = 96 PixelsPerInch = 96
TextHeight = 13 TextHeight = 15
object PageControl: TPageControl object PageControl: TPageControl
Left = 3 Left = 3
Top = 3 Top = 3
Width = 278 Width = 321
Height = 186 Height = 215
ActivePage = GeneralTabSheet ActivePage = SshTabSheet
TabIndex = 0 TabIndex = 3
TabOrder = 0 TabOrder = 0
object GeneralTabSheet: TTabSheet object GeneralTabSheet: TTabSheet
Caption = 'General' Caption = 'General'
object FirstNodeLabel: TLabel object FirstNodeLabel: TLabel
Left = 7 Left = 8
Top = 10 Top = 12
Width = 78 Width = 90
Height = 20 Height = 23
AutoSize = False AutoSize = False
Caption = 'First Node' Caption = 'First Node'
end end
object LastNodeLabel: TLabel object LastNodeLabel: TLabel
Left = 7 Left = 8
Top = 36 Top = 42
Width = 74 Width = 85
Height = 20 Height = 23
AutoSize = False AutoSize = False
Caption = 'Last Node' Caption = 'Last Node'
end end
object MaxConConLabel: TLabel object MaxConConLabel: TLabel
Left = 7 Left = 8
Top = 62 Top = 72
Width = 74 Width = 85
Height = 20 Height = 23
AutoSize = False AutoSize = False
Caption = 'Max Con-Conn' Caption = 'Max Con-Conn'
end end
object AutoStartCheckBox: TCheckBox object AutoStartCheckBox: TCheckBox
Left = 148 Left = 171
Top = 10 Top = 12
Width = 117 Width = 135
Height = 19 Height = 21
Hint = 'Automatically start Terminal server' Hint = 'Automatically start Terminal server'
Caption = 'Auto Startup' Caption = 'Auto Startup'
ParentShowHint = False ParentShowHint = False
...@@ -62,20 +62,20 @@ object TelnetCfgDlg: TTelnetCfgDlg ...@@ -62,20 +62,20 @@ object TelnetCfgDlg: TTelnetCfgDlg
TabOrder = 4 TabOrder = 4
end end
object FirstNodeEdit: TEdit object FirstNodeEdit: TEdit
Left = 85 Left = 98
Top = 10 Top = 12
Width = 39 Width = 45
Height = 21 Height = 23
Hint = 'First node number available for Terminal logins' Hint = 'First node number available for Terminal logins'
ParentShowHint = False ParentShowHint = False
ShowHint = True ShowHint = True
TabOrder = 0 TabOrder = 0
end end
object XtrnMinCheckBox: TCheckBox object XtrnMinCheckBox: TCheckBox
Left = 148 Left = 171
Top = 36 Top = 42
Width = 117 Width = 135
Height = 20 Height = 23
Hint = 'External programs run in a minimized window' Hint = 'External programs run in a minimized window'
Caption = 'Minimize Externals' Caption = 'Minimize Externals'
ParentShowHint = False ParentShowHint = False
...@@ -83,20 +83,20 @@ object TelnetCfgDlg: TTelnetCfgDlg ...@@ -83,20 +83,20 @@ object TelnetCfgDlg: TTelnetCfgDlg
TabOrder = 5 TabOrder = 5
end end
object LastNodeEdit: TEdit object LastNodeEdit: TEdit
Left = 85 Left = 98
Top = 36 Top = 42
Width = 39 Width = 45
Height = 21 Height = 23
Hint = 'Last node number available for Terminal logins' Hint = 'Last node number available for Terminal logins'
ParentShowHint = False ParentShowHint = False
ShowHint = True ShowHint = True
TabOrder = 1 TabOrder = 1
end end
object HostnameCheckBox: TCheckBox object HostnameCheckBox: TCheckBox
Left = 7 Left = 8
Top = 114 Top = 132
Width = 117 Width = 135
Height = 23 Height = 26
Hint = 'Automatically lookup client'#39's hostname via DNS' Hint = 'Automatically lookup client'#39's hostname via DNS'
Caption = 'Hostname Lookup' Caption = 'Hostname Lookup'
ParentShowHint = False ParentShowHint = False
...@@ -104,10 +104,10 @@ object TelnetCfgDlg: TTelnetCfgDlg ...@@ -104,10 +104,10 @@ object TelnetCfgDlg: TTelnetCfgDlg
TabOrder = 3 TabOrder = 3
end end
object QWKEventsCheckBox: TCheckBox object QWKEventsCheckBox: TCheckBox
Left = 148 Left = 171
Top = 114 Top = 132
Width = 117 Width = 135
Height = 20 Height = 23
Hint = 'Handle QWK Message Packet Events in This Instance' Hint = 'Handle QWK Message Packet Events in This Instance'
Caption = 'QWK Msg Events' Caption = 'QWK Msg Events'
ParentShowHint = False ParentShowHint = False
...@@ -115,10 +115,10 @@ object TelnetCfgDlg: TTelnetCfgDlg ...@@ -115,10 +115,10 @@ object TelnetCfgDlg: TTelnetCfgDlg
TabOrder = 7 TabOrder = 7
end end
object EventsCheckBox: TCheckBox object EventsCheckBox: TCheckBox
Left = 148 Left = 171
Top = 62 Top = 72
Width = 117 Width = 135
Height = 20 Height = 23
Hint = 'Enable the events thread' Hint = 'Enable the events thread'
Caption = 'Events Enabled' Caption = 'Events Enabled'
ParentShowHint = False ParentShowHint = False
...@@ -126,10 +126,10 @@ object TelnetCfgDlg: TTelnetCfgDlg ...@@ -126,10 +126,10 @@ object TelnetCfgDlg: TTelnetCfgDlg
TabOrder = 6 TabOrder = 6
end end
object DosSupportCheckBox: TCheckBox object DosSupportCheckBox: TCheckBox
Left = 7 Left = 8
Top = 88 Top = 102
Width = 130 Width = 150
Height = 20 Height = 23
Hint = 'Attempt to execute 16-bit DOS progarms (requires NTVDM)' Hint = 'Attempt to execute 16-bit DOS progarms (requires NTVDM)'
Caption = 'DOS Program Support' Caption = 'DOS Program Support'
ParentShowHint = False ParentShowHint = False
...@@ -137,10 +137,10 @@ object TelnetCfgDlg: TTelnetCfgDlg ...@@ -137,10 +137,10 @@ object TelnetCfgDlg: TTelnetCfgDlg
TabOrder = 8 TabOrder = 8
end end
object MaxConConEdit: TEdit object MaxConConEdit: TEdit
Left = 85 Left = 98
Top = 62 Top = 72
Width = 39 Width = 45
Height = 21 Height = 23
Hint = Hint =
'Maximum unauthenticated Concurrent Connections from same IP (0=u' + 'Maximum unauthenticated Concurrent Connections from same IP (0=u' +
'nlimited)' 'nlimited)'
...@@ -149,10 +149,10 @@ object TelnetCfgDlg: TTelnetCfgDlg ...@@ -149,10 +149,10 @@ object TelnetCfgDlg: TTelnetCfgDlg
TabOrder = 2 TabOrder = 2
end end
object EventsLogFileCheckBox: TCheckBox object EventsLogFileCheckBox: TCheckBox
Left = 148 Left = 171
Top = 88 Top = 102
Width = 117 Width = 135
Height = 20 Height = 23
Hint = 'Save event log messages to disk file in your DATA directory' Hint = 'Save event log messages to disk file in your DATA directory'
Caption = 'Log Events to Disk' Caption = 'Log Events to Disk'
ParentShowHint = False ParentShowHint = False
...@@ -164,26 +164,26 @@ object TelnetCfgDlg: TTelnetCfgDlg ...@@ -164,26 +164,26 @@ object TelnetCfgDlg: TTelnetCfgDlg
Caption = 'Telnet' Caption = 'Telnet'
ImageIndex = 1 ImageIndex = 1
object InterfaceLabel: TLabel object InterfaceLabel: TLabel
Left = 7 Left = 8
Top = 36 Top = 42
Width = 78 Width = 90
Height = 21 Height = 24
AutoSize = False AutoSize = False
Caption = 'Interfaces (IPs)' Caption = 'Interfaces (IPs)'
end end
object TelnetPortLabel: TLabel object TelnetPortLabel: TLabel
Left = 7 Left = 8
Top = 10 Top = 12
Width = 78 Width = 90
Height = 21 Height = 24
AutoSize = False AutoSize = False
Caption = 'Listening Port' Caption = 'Listening Port'
end end
object CmdLogCheckBox: TCheckBox object CmdLogCheckBox: TCheckBox
Left = 7 Left = 8
Top = 88 Top = 102
Width = 169 Width = 195
Height = 21 Height = 24
Hint = 'Log (debug) all transmitted and received Telnet commands' Hint = 'Log (debug) all transmitted and received Telnet commands'
Caption = 'Log Telnet Commands' Caption = 'Log Telnet Commands'
ParentShowHint = False ParentShowHint = False
...@@ -191,10 +191,10 @@ object TelnetCfgDlg: TTelnetCfgDlg ...@@ -191,10 +191,10 @@ object TelnetCfgDlg: TTelnetCfgDlg
TabOrder = 3 TabOrder = 3
end end
object TelnetInterfaceEdit: TEdit object TelnetInterfaceEdit: TEdit
Left = 85 Left = 98
Top = 36 Top = 42
Width = 156 Width = 180
Height = 21 Height = 23
Hint = Hint =
'Comma-separated list of IP addresses to accept incoming connecti' + 'Comma-separated list of IP addresses to accept incoming connecti' +
'ons' 'ons'
...@@ -203,20 +203,20 @@ object TelnetCfgDlg: TTelnetCfgDlg ...@@ -203,20 +203,20 @@ object TelnetCfgDlg: TTelnetCfgDlg
TabOrder = 1 TabOrder = 1
end end
object TelnetPortEdit: TEdit object TelnetPortEdit: TEdit
Left = 85 Left = 98
Top = 10 Top = 12
Width = 39 Width = 45
Height = 21 Height = 23
Hint = 'TCP port for incoming connections (default=23)' Hint = 'TCP port for incoming connections (default=23)'
ParentShowHint = False ParentShowHint = False
ShowHint = True ShowHint = True
TabOrder = 0 TabOrder = 0
end end
object TelnetGaCheckBox: TCheckBox object TelnetGaCheckBox: TCheckBox
Left = 7 Left = 8
Top = 62 Top = 72
Width = 169 Width = 195
Height = 21 Height = 24
Hint = Hint =
'Send periodic Telnet GA commands to help detect dropped connecti' + 'Send periodic Telnet GA commands to help detect dropped connecti' +
'ons' 'ons'
...@@ -226,10 +226,10 @@ object TelnetCfgDlg: TTelnetCfgDlg ...@@ -226,10 +226,10 @@ object TelnetCfgDlg: TTelnetCfgDlg
TabOrder = 2 TabOrder = 2
end end
object AutoLogonCheckBox: TCheckBox object AutoLogonCheckBox: TCheckBox
Left = 7 Left = 8
Top = 114 Top = 132
Width = 117 Width = 135
Height = 19 Height = 21
Hint = 'Allow V-exempt users to auto-logon based on their IP address' Hint = 'Allow V-exempt users to auto-logon based on their IP address'
Caption = 'AutoLogon via IP' Caption = 'AutoLogon via IP'
ParentShowHint = False ParentShowHint = False
...@@ -241,36 +241,36 @@ object TelnetCfgDlg: TTelnetCfgDlg ...@@ -241,36 +241,36 @@ object TelnetCfgDlg: TTelnetCfgDlg
Caption = 'RLogin' Caption = 'RLogin'
ImageIndex = 3 ImageIndex = 3
object RLoginPortLabel: TLabel object RLoginPortLabel: TLabel
Left = 7 Left = 8
Top = 10 Top = 12
Width = 78 Width = 90
Height = 21 Height = 24
AutoSize = False AutoSize = False
Caption = 'Listening Port' Caption = 'Listening Port'
end end
object RLoginInterfaceLabel: TLabel object RLoginInterfaceLabel: TLabel
Left = 7 Left = 8
Top = 36 Top = 42
Width = 78 Width = 90
Height = 21 Height = 24
AutoSize = False AutoSize = False
Caption = 'Interfaces (IPs)' Caption = 'Interfaces (IPs)'
end end
object RLoginPortEdit: TEdit object RLoginPortEdit: TEdit
Left = 85 Left = 98
Top = 10 Top = 12
Width = 39 Width = 45
Height = 21 Height = 23
Hint = 'TCP port for incoming connections (default=513)' Hint = 'TCP port for incoming connections (default=513)'
ParentShowHint = False ParentShowHint = False
ShowHint = True ShowHint = True
TabOrder = 0 TabOrder = 0
end end
object RLoginInterfaceEdit: TEdit object RLoginInterfaceEdit: TEdit
Left = 85 Left = 98
Top = 36 Top = 42
Width = 156 Width = 180
Height = 21 Height = 23
Hint = Hint =
'Comma-separated list of IP addresses to accept incoming connecti' + 'Comma-separated list of IP addresses to accept incoming connecti' +
'ons' 'ons'
...@@ -279,10 +279,10 @@ object TelnetCfgDlg: TTelnetCfgDlg ...@@ -279,10 +279,10 @@ object TelnetCfgDlg: TTelnetCfgDlg
TabOrder = 2 TabOrder = 2
end end
object RLoginEnabledCheckBox: TCheckBox object RLoginEnabledCheckBox: TCheckBox
Left = 184 Left = 212
Top = 10 Top = 12
Width = 73 Width = 85
Height = 17 Height = 19
Hint = 'Enable the RLogin port' Hint = 'Enable the RLogin port'
Caption = 'Enabled' Caption = 'Enabled'
ParentShowHint = False ParentShowHint = False
...@@ -291,10 +291,10 @@ object TelnetCfgDlg: TTelnetCfgDlg ...@@ -291,10 +291,10 @@ object TelnetCfgDlg: TTelnetCfgDlg
OnClick = RLoginEnabledCheckBoxClick OnClick = RLoginEnabledCheckBoxClick
end end
object RLoginIPallowButton: TButton object RLoginIPallowButton: TButton
Left = 8 Left = 9
Top = 62 Top = 72
Width = 233 Width = 269
Height = 21 Height = 24
Hint = Hint =
'IP addresses of trusted hosts to allow unauthenticed RLogins fro' + 'IP addresses of trusted hosts to allow unauthenticed RLogins fro' +
'm' 'm'
...@@ -309,44 +309,52 @@ object TelnetCfgDlg: TTelnetCfgDlg ...@@ -309,44 +309,52 @@ object TelnetCfgDlg: TTelnetCfgDlg
Caption = 'SSH' Caption = 'SSH'
ImageIndex = 4 ImageIndex = 4
object SshPortLabel: TLabel object SshPortLabel: TLabel
Left = 7 Left = 8
Top = 10 Top = 12
Width = 78 Width = 90
Height = 21 Height = 24
AutoSize = False AutoSize = False
Caption = 'Listening Port' Caption = 'Listening Port'
end end
object SshInterfaceLabel: TLabel object SshInterfaceLabel: TLabel
Left = 7 Left = 8
Top = 36 Top = 42
Width = 78 Width = 90
Height = 21 Height = 24
AutoSize = False AutoSize = False
Caption = 'Interfaces (IPs)' Caption = 'Interfaces (IPs)'
end end
object SshConnectTimeoutLabel: TLabel object SshConnectTimeoutLabel: TLabel
Left = 7 Left = 8
Top = 62 Top = 72
Width = 78 Width = 90
Height = 21 Height = 24
AutoSize = False AutoSize = False
Caption = 'Conn Timeout' Caption = 'Conn Timeout'
end end
object SFTPMaxInactivityLabel: TLabel
Left = 8
Top = 136
Width = 90
Height = 24
AutoSize = False
Caption = 'Max Inactivity'
end
object SshPortEdit: TEdit object SshPortEdit: TEdit
Left = 85 Left = 98
Top = 10 Top = 12
Width = 39 Width = 45
Height = 21 Height = 23
Hint = 'TCP port for incoming connections (default=22)' Hint = 'TCP port for incoming connections (default=22)'
ParentShowHint = False ParentShowHint = False
ShowHint = True ShowHint = True
TabOrder = 0 TabOrder = 0
end end
object SshEnabledCheckBox: TCheckBox object SshEnabledCheckBox: TCheckBox
Left = 184 Left = 212
Top = 10 Top = 12
Width = 73 Width = 85
Height = 17 Height = 19
Hint = 'Enable the Secure Shell (SSH) port' Hint = 'Enable the Secure Shell (SSH) port'
Caption = 'Enabled' Caption = 'Enabled'
ParentShowHint = False ParentShowHint = False
...@@ -355,10 +363,10 @@ object TelnetCfgDlg: TTelnetCfgDlg ...@@ -355,10 +363,10 @@ object TelnetCfgDlg: TTelnetCfgDlg
OnClick = SshEnabledCheckBoxClick OnClick = SshEnabledCheckBoxClick
end end
object SshInterfaceEdit: TEdit object SshInterfaceEdit: TEdit
Left = 85 Left = 98
Top = 36 Top = 42
Width = 156 Width = 180
Height = 21 Height = 23
Hint = Hint =
'Comma-separated list of IP addresses to accept incoming connecti' + 'Comma-separated list of IP addresses to accept incoming connecti' +
'ons' 'ons'
...@@ -367,24 +375,45 @@ object TelnetCfgDlg: TTelnetCfgDlg ...@@ -367,24 +375,45 @@ object TelnetCfgDlg: TTelnetCfgDlg
TabOrder = 2 TabOrder = 2
end end
object SshConnTimeoutEdit: TEdit object SshConnTimeoutEdit: TEdit
Left = 85 Left = 98
Top = 62 Top = 72
Width = 39 Width = 45
Height = 21 Height = 23
Hint = 'SSH Connection Timeout (in seconds)' Hint = 'SSH Connection Timeout'
ParentShowHint = False ParentShowHint = False
ShowHint = True ShowHint = True
TabOrder = 3 TabOrder = 3
end end
object SFTPEnabledCheckBox: TCheckBox
Left = 8
Top = 102
Width = 195
Height = 24
Hint = 'Enable SSH File Transfer (SFTP) support'
Caption = 'File Transfer (SFTP) Support'
ParentShowHint = False
ShowHint = True
TabOrder = 4
end
object SFTPMaxInactivityEdit: TEdit
Left = 98
Top = 136
Width = 45
Height = 23
Hint = 'Maximum SFTP Session Inactivity'
ParentShowHint = False
ShowHint = True
TabOrder = 5
end
end end
object SoundTabSheet: TTabSheet object SoundTabSheet: TTabSheet
Caption = 'Sound' Caption = 'Sound'
ImageIndex = 2 ImageIndex = 2
object ConfigureSoundButton: TButton object ConfigureSoundButton: TButton
Left = 8 Left = 9
Top = 8 Top = 9
Width = 257 Width = 297
Height = 25 Height = 29
Caption = 'Configure Common Server Event Sounds' Caption = 'Configure Common Server Event Sounds'
TabOrder = 0 TabOrder = 0
OnClick = ConfigureSoundButtonClick OnClick = ConfigureSoundButtonClick
...@@ -392,10 +421,10 @@ object TelnetCfgDlg: TTelnetCfgDlg ...@@ -392,10 +421,10 @@ object TelnetCfgDlg: TTelnetCfgDlg
end end
end end
object OKBtn: TButton object OKBtn: TButton
Left = 20 Left = 23
Top = 201 Top = 232
Width = 76 Width = 88
Height = 25 Height = 29
Caption = 'OK' Caption = 'OK'
Default = True Default = True
ModalResult = 1 ModalResult = 1
...@@ -403,20 +432,20 @@ object TelnetCfgDlg: TTelnetCfgDlg ...@@ -403,20 +432,20 @@ object TelnetCfgDlg: TTelnetCfgDlg
OnClick = OKBtnClick OnClick = OKBtnClick
end end
object CancelBtn: TButton object CancelBtn: TButton
Left = 104 Left = 120
Top = 201 Top = 232
Width = 75 Width = 87
Height = 25 Height = 29
Cancel = True Cancel = True
Caption = 'Cancel' Caption = 'Cancel'
ModalResult = 2 ModalResult = 2
TabOrder = 2 TabOrder = 2
end end
object ApplyBtn: TButton object ApplyBtn: TButton
Left = 189 Left = 218
Top = 201 Top = 232
Width = 76 Width = 88
Height = 25 Height = 29
Cancel = True Cancel = True
Caption = 'Apply' Caption = 'Apply'
TabOrder = 3 TabOrder = 3
......
...@@ -97,6 +97,9 @@ __published: ...@@ -97,6 +97,9 @@ __published:
TEdit *SshConnTimeoutEdit; TEdit *SshConnTimeoutEdit;
TButton *ConfigureSoundButton; TButton *ConfigureSoundButton;
TCheckBox *EventsLogFileCheckBox; TCheckBox *EventsLogFileCheckBox;
TCheckBox *SFTPEnabledCheckBox;
TLabel *SFTPMaxInactivityLabel;
TEdit *SFTPMaxInactivityEdit;
void __fastcall FormShow(TObject *Sender); void __fastcall FormShow(TObject *Sender);
void __fastcall OKBtnClick(TObject *Sender); void __fastcall OKBtnClick(TObject *Sender);
void __fastcall RLoginEnabledCheckBoxClick(TObject *Sender); void __fastcall RLoginEnabledCheckBoxClick(TObject *Sender);
......
...@@ -43,6 +43,7 @@ static const char* strMaxInactivity="MaxInactivity"; ...@@ -43,6 +43,7 @@ static const char* strMaxInactivity="MaxInactivity";
static const char* strMaxLoginInactivity="MaxLoginInactivity"; static const char* strMaxLoginInactivity="MaxLoginInactivity";
static const char* strMaxNewUserInactivity="MaxNewUserInactivity"; static const char* strMaxNewUserInactivity="MaxNewUserInactivity";
static const char* strMaxSessionInactivity="MaxSessionInactivity"; static const char* strMaxSessionInactivity="MaxSessionInactivity";
static const char* strMaxSFTPInactivity="MaxSFTPInactivity";
static const char* strMaxConConn="MaxConcurrentConnections"; static const char* strMaxConConn="MaxConcurrentConnections";
static const char* strHostName="HostName"; static const char* strHostName="HostName";
static const char* strLogLevel="LogLevel"; static const char* strLogLevel="LogLevel";
...@@ -516,6 +517,7 @@ void sbbs_read_ini( ...@@ -516,6 +517,7 @@ void sbbs_read_ini(
bbs->max_login_inactivity = (uint16_t)iniGetDuration(list, section, strMaxLoginInactivity, 10 * 60); bbs->max_login_inactivity = (uint16_t)iniGetDuration(list, section, strMaxLoginInactivity, 10 * 60);
bbs->max_newuser_inactivity = (uint16_t)iniGetDuration(list, section, strMaxNewUserInactivity, 60 * 60); bbs->max_newuser_inactivity = (uint16_t)iniGetDuration(list, section, strMaxNewUserInactivity, 60 * 60);
bbs->max_session_inactivity = (uint16_t)iniGetDuration(list, section, strMaxSessionInactivity, 0); bbs->max_session_inactivity = (uint16_t)iniGetDuration(list, section, strMaxSessionInactivity, 0);
bbs->max_sftp_inactivity = (uint16_t)iniGetDuration(list, section, strMaxSFTPInactivity, FTP_DEFAULT_MAX_INACTIVITY);
SAFECOPY(bbs->web_file_vpath_prefix, iniGetString(list, "web", strFileVPathPrefix, nulstr, value)); SAFECOPY(bbs->web_file_vpath_prefix, iniGetString(list, "web", strFileVPathPrefix, nulstr, value));
} }
...@@ -943,6 +945,8 @@ bool sbbs_write_ini( ...@@ -943,6 +945,8 @@ bool sbbs_write_ini(
break; break;
if(!iniSetDuration(lp, section, strMaxSessionInactivity, bbs->max_session_inactivity, &style)) if(!iniSetDuration(lp, section, strMaxSessionInactivity, bbs->max_session_inactivity, &style))
break; break;
if(!iniSetDuration(lp, section, strMaxSFTPInactivity, bbs->max_sftp_inactivity, &style))
break;
if(bbs->sem_chk_freq==global->sem_chk_freq) if(bbs->sem_chk_freq==global->sem_chk_freq)
iniRemoveValue(lp,section,strSemFileCheckFrequency); iniRemoveValue(lp,section,strSemFileCheckFrequency);
......
...@@ -352,6 +352,8 @@ static void telnet_srvr_cfg(bbs_startup_t* startup) ...@@ -352,6 +352,8 @@ static void telnet_srvr_cfg(bbs_startup_t* startup)
startup->options ^= BBS_OPT_NO_TELNET; startup->options ^= BBS_OPT_NO_TELNET;
break; break;
case 1: case 1:
if(startup->options & BBS_OPT_NO_TELNET)
break;
strListCombine(startup->telnet_interfaces, str, sizeof(str), ", "); strListCombine(startup->telnet_interfaces, str, sizeof(str), ", ");
if(uifc.input(WIN_MID|WIN_SAV, 0, 0, "Telnet Network Interfaces (IPv4/6)", str, sizeof(str)-1, K_EDIT) >= 0) { if(uifc.input(WIN_MID|WIN_SAV, 0, 0, "Telnet Network Interfaces (IPv4/6)", str, sizeof(str)-1, K_EDIT) >= 0) {
strListFree(&startup->telnet_interfaces); strListFree(&startup->telnet_interfaces);
...@@ -360,14 +362,20 @@ static void telnet_srvr_cfg(bbs_startup_t* startup) ...@@ -360,14 +362,20 @@ static void telnet_srvr_cfg(bbs_startup_t* startup)
} }
break; break;
case 2: case 2:
if(startup->options & BBS_OPT_NO_TELNET)
break;
SAFEPRINTF(str, "%u", startup->telnet_port); SAFEPRINTF(str, "%u", startup->telnet_port);
if(uifc.input(WIN_MID|WIN_SAV, 0, 0, "Telnet TCP Port", str, 5, K_NUMBER|K_EDIT) > 0) if(uifc.input(WIN_MID|WIN_SAV, 0, 0, "Telnet TCP Port", str, 5, K_NUMBER|K_EDIT) > 0)
startup->telnet_port = atoi(str); startup->telnet_port = atoi(str);
break; break;
case 3: case 3:
if(startup->options & BBS_OPT_NO_TELNET)
break;
startup->options ^= BBS_OPT_DEBUG_TELNET; startup->options ^= BBS_OPT_DEBUG_TELNET;
break; break;
case 4: case 4:
if(startup->options & BBS_OPT_NO_TELNET)
break;
startup->options ^= BBS_OPT_NO_TELNET_GA; startup->options ^= BBS_OPT_NO_TELNET_GA;
break; break;
default: default:
...@@ -391,7 +399,13 @@ static void ssh_srvr_cfg(bbs_startup_t* startup) ...@@ -391,7 +399,13 @@ static void ssh_srvr_cfg(bbs_startup_t* startup)
snprintf(opt[i++], MAX_OPLN, "%-30s%u", "Port", startup->ssh_port); snprintf(opt[i++], MAX_OPLN, "%-30s%u", "Port", startup->ssh_port);
snprintf(opt[i++], MAX_OPLN, "%-30s%s", "Connect Timeout" snprintf(opt[i++], MAX_OPLN, "%-30s%s", "Connect Timeout"
,startup->options & BBS_OPT_ALLOW_SSH ? vduration(startup->ssh_connect_timeout) : "N/A"); ,startup->options & BBS_OPT_ALLOW_SSH ? vduration(startup->ssh_connect_timeout) : "N/A");
snprintf(opt[i++], MAX_OPLN, "%-30s%s", "Error Level", iniLogLevelStringList()[startup->ssh_error_level]); snprintf(opt[i++], MAX_OPLN, "%-30s%s", "Error Level"
,startup->options & BBS_OPT_ALLOW_SSH ? iniLogLevelStringList()[startup->ssh_error_level] : "N/A");
snprintf(opt[i++], MAX_OPLN, "%-30s%s", "File Transfer (SFTP) Support"
,startup->options & BBS_OPT_ALLOW_SSH ? (startup->options & BBS_OPT_ALLOW_SFTP ? "Yes" : "No") : "N/A");
snprintf(opt[i++], MAX_OPLN, "%-30s%s", "Max SFTP Inactivity"
,(startup->options & BBS_OPT_ALLOW_SSH) && (startup->options & BBS_OPT_ALLOW_SFTP) ? vduration(startup->max_sftp_inactivity) : "N/A");
opt[i][0] = '\0'; opt[i][0] = '\0';
switch(uifc.list(WIN_ACT|WIN_ESC|WIN_RHT|WIN_SAV, 0, 0, 0, &cur, &bar switch(uifc.list(WIN_ACT|WIN_ESC|WIN_RHT|WIN_SAV, 0, 0, 0, &cur, &bar
...@@ -400,6 +414,8 @@ static void ssh_srvr_cfg(bbs_startup_t* startup) ...@@ -400,6 +414,8 @@ static void ssh_srvr_cfg(bbs_startup_t* startup)
startup->options ^= BBS_OPT_ALLOW_SSH; startup->options ^= BBS_OPT_ALLOW_SSH;
break; break;
case 1: case 1:
if(!(startup->options & BBS_OPT_ALLOW_SSH))
break;
strListCombine(startup->ssh_interfaces, str, sizeof(str), ", "); strListCombine(startup->ssh_interfaces, str, sizeof(str), ", ");
if(uifc.input(WIN_MID|WIN_SAV, 0, 0, "SSH Network Interfaces (IPv4/6)", str, sizeof(str)-1, K_EDIT) >= 0) { if(uifc.input(WIN_MID|WIN_SAV, 0, 0, "SSH Network Interfaces (IPv4/6)", str, sizeof(str)-1, K_EDIT) >= 0) {
strListFree(&startup->ssh_interfaces); strListFree(&startup->ssh_interfaces);
...@@ -408,18 +424,38 @@ static void ssh_srvr_cfg(bbs_startup_t* startup) ...@@ -408,18 +424,38 @@ static void ssh_srvr_cfg(bbs_startup_t* startup)
} }
break; break;
case 2: case 2:
if(!(startup->options & BBS_OPT_ALLOW_SSH))
break;
SAFEPRINTF(str, "%u", startup->ssh_port); SAFEPRINTF(str, "%u", startup->ssh_port);
if(uifc.input(WIN_MID|WIN_SAV, 0, 0, "SSH TCP Port", str, 5, K_NUMBER|K_EDIT) > 0) if(uifc.input(WIN_MID|WIN_SAV, 0, 0, "SSH TCP Port", str, 5, K_NUMBER|K_EDIT) > 0)
startup->ssh_port = atoi(str); startup->ssh_port = atoi(str);
break; break;
case 3: case 3:
if(!(startup->options & BBS_OPT_ALLOW_SSH))
break;
SAFECOPY(str, duration(startup->ssh_connect_timeout, false)); SAFECOPY(str, duration(startup->ssh_connect_timeout, false));
if(uifc.input(WIN_MID|WIN_SAV, 0, 0, "SSH Connect Timeout", str, 6, K_EDIT) > 0) if(uifc.input(WIN_MID|WIN_SAV, 0, 0, "SSH Connect Timeout", str, 6, K_EDIT) > 0)
startup->ssh_connect_timeout = (uint16_t)parse_duration(str); startup->ssh_connect_timeout = (uint16_t)parse_duration(str);
break; break;
case 4: case 4:
if(!(startup->options & BBS_OPT_ALLOW_SSH))
break;
uifc.list(WIN_MID|WIN_SAV, 0, 0, 0, &startup->ssh_error_level, 0, "SSH Error Log Level", iniLogLevelStringList()); uifc.list(WIN_MID|WIN_SAV, 0, 0, 0, &startup->ssh_error_level, 0, "SSH Error Log Level", iniLogLevelStringList());
break; break;
case 5:
if(!(startup->options & BBS_OPT_ALLOW_SSH))
break;
startup->options ^= BBS_OPT_ALLOW_SFTP;
break;
case 6:
if(!(startup->options & BBS_OPT_ALLOW_SSH))
break;
if(!(startup->options & BBS_OPT_ALLOW_SFTP))
break;
SAFECOPY(str, duration(startup->max_sftp_inactivity, false));
if(uifc.input(WIN_MID|WIN_SAV, 0, 0, "Maximum Socket Inactivity during SFTP Session", str, 10, K_EDIT) > 0)
startup->max_sftp_inactivity = (uint16_t)parse_duration(str);
break;
default: default:
return; return;
} }
...@@ -447,6 +483,8 @@ static void rlogin_srvr_cfg(bbs_startup_t* startup) ...@@ -447,6 +483,8 @@ static void rlogin_srvr_cfg(bbs_startup_t* startup)
startup->options ^= BBS_OPT_ALLOW_RLOGIN; startup->options ^= BBS_OPT_ALLOW_RLOGIN;
break; break;
case 1: case 1:
if(!(startup->options & BBS_OPT_ALLOW_RLOGIN))
break;
strListCombine(startup->rlogin_interfaces, str, sizeof(str), ", "); strListCombine(startup->rlogin_interfaces, str, sizeof(str), ", ");
if(uifc.input(WIN_MID|WIN_SAV, 0, 0, "RLogin Network Interfaces (IPv4/6)", str, sizeof(str)-1, K_EDIT) >= 0) { if(uifc.input(WIN_MID|WIN_SAV, 0, 0, "RLogin Network Interfaces (IPv4/6)", str, sizeof(str)-1, K_EDIT) >= 0) {
strListFree(&startup->rlogin_interfaces); strListFree(&startup->rlogin_interfaces);
...@@ -455,6 +493,8 @@ static void rlogin_srvr_cfg(bbs_startup_t* startup) ...@@ -455,6 +493,8 @@ static void rlogin_srvr_cfg(bbs_startup_t* startup)
} }
break; break;
case 2: case 2:
if(!(startup->options & BBS_OPT_ALLOW_RLOGIN))
break;
SAFEPRINTF(str, "%u", startup->rlogin_port); SAFEPRINTF(str, "%u", startup->rlogin_port);
if(uifc.input(WIN_MID|WIN_SAV, 0, 0, "RLogin TCP Port", str, 5, K_NUMBER|K_EDIT) > 0) if(uifc.input(WIN_MID|WIN_SAV, 0, 0, "RLogin TCP Port", str, 5, K_NUMBER|K_EDIT) > 0)
startup->rlogin_port = atoi(str); startup->rlogin_port = atoi(str);
...@@ -469,7 +509,6 @@ static void termsrvr_cfg(void) ...@@ -469,7 +509,6 @@ static void termsrvr_cfg(void)
{ {
static int cur, bar; static int cur, bar;
char str[256]; char str[256];
char tmp[256];
bool enabled = false; bool enabled = false;
bbs_startup_t startup = {0}; bbs_startup_t startup = {0};
......
...@@ -160,6 +160,7 @@ typedef struct { ...@@ -160,6 +160,7 @@ typedef struct {
uint16_t max_login_inactivity; // seconds uint16_t max_login_inactivity; // seconds
uint16_t max_newuser_inactivity; // seconds uint16_t max_newuser_inactivity; // seconds
uint16_t max_session_inactivity; // seconds uint16_t max_session_inactivity; // seconds
uint16_t max_sftp_inactivity; // seconds
/* JavaScript operating parameters */ /* JavaScript operating parameters */
js_startup_t js; js_startup_t js;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment