1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2024-12-26 01:59:53 +03:00

Cedar/Command: Implement PortsUDPGet and PortsUDPSet commands

PortsUDPSet: This command can be used to specify a single or multiple UDP ports the server should listen on. "0" can be specified to disable the UDP listener.
Administrator privileges are required to execute the command.

PortsUDPGet: This command can be used to retrieve the UDP ports the server is listening on.

The two commands replace the functionality that was previously provided by OpenVpnEnable and OpenVpnGet, respectively.
This commit is contained in:
Davide Beatrici 2020-05-20 03:11:22 +02:00
parent 37f28b4119
commit 9e6476c7b2
9 changed files with 207 additions and 0 deletions

View File

@ -7505,6 +7505,8 @@ void PsMain(PS *ps)
{"ListenerList", PsListenerList},
{"ListenerEnable", PsListenerEnable},
{"ListenerDisable", PsListenerDisable},
{"PortsUDPGet", PsPortsUDPGet},
{"PortsUDPSet", PsPortsUDPSet},
{"ServerPasswordSet", PsServerPasswordSet},
{"ClusterSettingGet", PsClusterSettingGet},
{"ClusterSettingStandalone", PsClusterSettingStandalone},
@ -22888,6 +22890,111 @@ UINT PsListenerEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param)
return 0;
}
// Set UDP ports the server should listen on
UINT PsPortsUDPSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param)
{
LIST *o, *ports;
PS *ps = (PS *)param;
UINT ret;
RPC_PORTS t;
PARAM args[] =
{
{"[ports]", CmdPrompt, _UU("CMD_PortsUDPSet_[ports]"), CmdEvalPortList, (void *)false}
};
o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0]));
if (o == NULL)
{
return ERR_INVALID_PARAMETER;
}
ports = StrToPortList(GetParamStr(o, "[ports]"), false);
FreeParamValueList(o);
t.Num = LIST_NUM(ports);
if (t.Num > 0)
{
UINT i;
t.Ports = Malloc(sizeof(UINT) * t.Num);
for (i = 0; i < t.Num; ++i)
{
t.Ports[i] = (UINT)LIST_DATA(ports, i);
}
}
else
{
t.Ports = NULL;
}
ReleaseList(ports);
ret = ScSetPortsUDP(ps->Rpc, &t);
if (ret != ERR_NO_ERROR)
{
CmdPrintError(c, ret);
}
Free(t.Ports);
return ret;
}
// List UDP ports the server is listening on
UINT PsPortsUDPGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param)
{
LIST *o;
PS *ps = (PS *)param;
UINT ret;
RPC_PORTS t;
o = ParseCommandList(c, cmd_name, str, NULL, 0);
if (o == NULL)
{
return ERR_INVALID_PARAMETER;
}
FreeParamValueList(o);
Zero(&t, sizeof(t));
ret = ScGetPortsUDP(ps->Rpc, &t);
if (ret == ERR_NO_ERROR)
{
wchar_t str[MAX_SIZE];
CT *ct = CtNewStandard();
Zero(str, sizeof(str));
if (t.Num > 0)
{
UINT i;
wchar_t buf[MAX_SIZE];
UniFormat(buf, sizeof(buf), L"%u", t.Ports[0]);
UniStrCat(str, sizeof(str), buf);
for (i = 1; i < t.Num; ++i)
{
UniFormat(buf, sizeof(buf), L", %u", t.Ports[i]);
UniStrCat(str, sizeof(str), buf);
}
}
CtInsert(ct, _UU("CMD_PortsUDPGet_Ports"), str);
CtFree(ct, c);
}
else
{
CmdPrintError(c, ret);
}
FreeRpcPorts(&t);
return ret;
}
// Draw a row of console table
void CtPrintRow(CONSOLE *c, UINT num, UINT *widths, wchar_t **strings, bool *rights, char separate_char)
{

View File

@ -398,6 +398,8 @@ UINT PsListenerDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param);
UINT PsListenerList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param);
UINT PsListenerEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param);
UINT PsListenerDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param);
UINT PsPortsUDPSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param);
UINT PsPortsUDPGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param);
UINT PsServerPasswordSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param);
UINT PsClusterSettingGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param);
UINT PsClusterSettingStandalone(CONSOLE *c, char *cmd_name, wchar_t *str, void *param);

View File

@ -4567,6 +4567,20 @@ CMD_ListenerDisable_[port] 使用一个整数,指定要停止的 TCP/IP 监
CMD_ListenerDisable_PortPrompt 启动 TCP/IP 监听器端口号:
# PortsUDPSet command
CMD_PortsUDPSet Sets the UDP ports that the server should listen on
CMD_PortsUDPSet_Help This command can be used to specify a single or multiple UDP ports the server should listen on. \nYou can specify a port that is used by another process, however the server will not be able to use it until the port becomes free. \nSpecify a port number that is within the range of 1 to 65535. \nYou can list the ports that are currently set with the PortsUDPGet command. \nTo execute this command, you must have VPN Server administrator privileges.
CMD_PortsUDPSet_Args PortsUDPSet [ports]
CMD_PortsUDPSet_[ports] Multiple UDP ports can be specified by splitting them with a space or a comma, for example: "443, 992, 1194, 5555". \nSpecify "0" to disable the UDP listener. \n\nPorts:
# PortsUDPGet command
CMD_PortsUDPGet Lists the UDP ports that the server is listening on
CMD_PortsUDPGet_Help This command can be used to retrieve the UDP ports the server is listening on. \nYou can set the ports with the PortsUDPSet command.
CMD_PortsUDPGet_Args PortsUDPGet
CMD_PortsUDPGet_Ports UDP ports
# ServerPasswordSet 命令
CMD_ServerPasswordSet 设置 VPN Server 管理员密码
CMD_ServerPasswordSet_Help 这将设置 VPN Server 管理员密码。您可以指定密码为一个参数。如果密码没有指定,将显示提示输入密码和密码确认。如果指定密码为一个参数,这个密码将在屏幕上显示瞬间,这构成了风险。我们建议尽可能避免指定这个参数,使用密码提示输入密码。\n为了执行这个命令您必须有 VPN Server 管理员权限。

View File

@ -4549,6 +4549,20 @@ CMD_ListenerDisable_[port] Using an integer, specify the port number of the TCP/
CMD_ListenerDisable_PortPrompt Port number of TCP/IP Listener to start:
# PortsUDPSet command
CMD_PortsUDPSet Sets the UDP ports that the server should listen on
CMD_PortsUDPSet_Help This command can be used to specify a single or multiple UDP ports the server should listen on. \nYou can specify a port that is used by another process, however the server will not be able to use it until the port becomes free. \nSpecify a port number that is within the range of 1 to 65535. \nYou can list the ports that are currently set with the PortsUDPGet command. \nTo execute this command, you must have VPN Server administrator privileges.
CMD_PortsUDPSet_Args PortsUDPSet [ports]
CMD_PortsUDPSet_[ports] Multiple UDP ports can be specified by splitting them with a space or a comma, for example: "443, 992, 1194, 5555". \nSpecify "0" to disable the UDP listener. \n\nPorts:
# PortsUDPGet command
CMD_PortsUDPGet Lists the UDP ports that the server is listening on
CMD_PortsUDPGet_Help This command can be used to retrieve the UDP ports the server is listening on. \nYou can set the ports with the PortsUDPSet command.
CMD_PortsUDPGet_Args PortsUDPGet
CMD_PortsUDPGet_Ports UDP ports
# ServerPasswordSet command
CMD_ServerPasswordSet Set VPN Server Administrator Password
CMD_ServerPasswordSet_Help This sets the VPN Server administrator password. You can specify the password as a parameter. If the password is not specified, a prompt will be displayed to input the password and password confirmation. If you include the password as a parameter, this password will be displayed momentarily on the screen, which poses a risk. We recommend that whenever possible, avoid specifying this parameter and input the password using the password prompt. \nTo execute this command, you must have VPN Server administrator privileges.

View File

@ -4552,6 +4552,20 @@ CMD_ListenerDisable_[port] 停止する TCP/IP リスナーのポート番号を
CMD_ListenerDisable_PortPrompt 開始する TCP/IP リスナーのポート番号:
# PortsUDPSet command
CMD_PortsUDPSet サーバーが着信を受付ける UDP ポート番号の一覧を設定します。
CMD_PortsUDPSet_Help このコマンドを使用すると、このサーバーが着信を受付ける単一または複数の UDP ポートの一覧を設定することができます。\n他のプロセスによって使用されている UDP ポートを設定することも可能ですが、そのポートが解放されるまでは機能しません。\nポート番号は、1 から 65535 の間で指定します。\n現在設定されているポートの一覧は、PortsUDPGet コマンドを使用して確認することができます。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。
CMD_PortsUDPSet_Args PortsUDPSet [ports]
CMD_PortsUDPSet_[ports] 複数のポート番号を指定する場合は、スペース文字またはカンマ文字で区切ってください。例: "443, 992, 1194, 5555". \n"0" を指定すると、UDP リスナーを無効化することができます。\n\nポート一覧:
# PortsUDPGet command
CMD_PortsUDPGet サーバーにおける着信 UDP ポートの一覧を表示します。
CMD_PortsUDPGet_Help このコマンドを使用すると、サーバーで待受け状態になっている UDP ポートの一覧を表示することができます。\nポートの設定を変更するには、PortsUDPSet コマンドを使用してください。
CMD_PortsUDPGet_Args PortsUDPGet
CMD_PortsUDPGet_Ports UDP ポート一覧
# ServerPasswordSet コマンド
CMD_ServerPasswordSet VPN Server の管理者パスワードの設定
CMD_ServerPasswordSet_Help VPN Server の管理者パスワードを設定します。パラメータとしてパスワードを指定することができます。パラメータを指定しない場合は、パスワードと、その確認入力を行なうためのプロンプトが表示されます。パスワードをパラメータに与えた場合、そのパスワードが一時的に画面に表示されるため危険です。できる限り、パラメータを指定せずに、パスワードプロンプトを用いてパスワードを入力することを推奨します。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。

View File

@ -4530,6 +4530,20 @@ CMD_ListenerDisable_[port] 중지 TCP/IP 리스너의 포트 번호를 정수로
CMD_ListenerDisable_PortPrompt 시작하는 TCP/IP 리스너 포트 번호:
# PortsUDPSet command
CMD_PortsUDPSet Sets the UDP ports that the server should listen on
CMD_PortsUDPSet_Help This command can be used to specify a single or multiple UDP ports the server should listen on. \nYou can specify a port that is used by another process, however the server will not be able to use it until the port becomes free. \nSpecify a port number that is within the range of 1 to 65535. \nYou can list the ports that are currently set with the PortsUDPGet command. \nTo execute this command, you must have VPN Server administrator privileges.
CMD_PortsUDPSet_Args PortsUDPSet [ports]
CMD_PortsUDPSet_[ports] Multiple UDP ports can be specified by splitting them with a space or a comma, for example: "443, 992, 1194, 5555". \nSpecify "0" to disable the UDP listener. \n\nPorts:
# PortsUDPGet command
CMD_PortsUDPGet Lists the UDP ports that the server is listening on
CMD_PortsUDPGet_Help This command can be used to retrieve the UDP ports the server is listening on. \nYou can set the ports with the PortsUDPSet command.
CMD_PortsUDPGet_Args PortsUDPGet
CMD_PortsUDPGet_Ports UDP ports
# ServerPasswordSet 명령
CMD_ServerPasswordSet VPN Server 관리자 암호 설정
CMD_ServerPasswordSet_Help VPN Server 관리자 암호를 설정합니다. 매개 변수로 암호를 지정 할 수 있습니다. 매개 변수를 지정하지 않으면, 패스워드와 그 확인 입력을위한 프롬프트가 표시됩니다. 비밀번호를 매개 변수로 주었을 경우, 암호가 일시적으로 화면에 표시되기 때문에 위험합니다. 가능한 매개 변수를 지정하지 않고 암호 프롬프트를 사용하여 암호를 입력 할 것을 권장합니다. \n이 명령을 실행하려면 VPN Server 관리자 권한이 있어야합니다.

View File

@ -4271,6 +4271,20 @@ CMD_ListenerDisable_[port] Using an integer, specify the port number of the TCP/
CMD_ListenerDisable_PortPrompt Port number of TCP/IP Listener to start:
# PortsUDPSet command
CMD_PortsUDPSet Sets the UDP ports that the server should listen on
CMD_PortsUDPSet_Help This command can be used to specify a single or multiple UDP ports the server should listen on. \nYou can specify a port that is used by another process, however the server will not be able to use it until the port becomes free. \nSpecify a port number that is within the range of 1 to 65535. \nYou can list the ports that are currently set with the PortsUDPGet command. \nTo execute this command, you must have VPN Server administrator privileges.
CMD_PortsUDPSet_Args PortsUDPSet [ports]
CMD_PortsUDPSet_[ports] Multiple UDP ports can be specified by splitting them with a space or a comma, for example: "443, 992, 1194, 5555". \nSpecify "0" to disable the UDP listener. \n\nPorts:
# PortsUDPGet command
CMD_PortsUDPGet Lists the UDP ports that the server is listening on
CMD_PortsUDPGet_Help This command can be used to retrieve the UDP ports the server is listening on. \nYou can set the ports with the PortsUDPSet command.
CMD_PortsUDPGet_Args PortsUDPGet
CMD_PortsUDPGet_Ports UDP ports
# ServerPasswordSet command
CMD_ServerPasswordSet Set VPN Server Administrator Password
CMD_ServerPasswordSet_Help This sets the VPN Server administrator password. You can specify the password as a parameter. If the password is not specified, a prompt will be displayed to input the password and password confirmation. If you include the password as a parameter, this password will be displayed momentarily on the screen, which poses a risk. We recommend that whenever possible, avoid specifying this parameter and input the password using the password prompt. \nTo execute this command, you must have VPN Server administrator privileges.

View File

@ -4549,6 +4549,20 @@ CMD_ListenerDisable_[port] Using an integer, specify the port number of the TCP/
CMD_ListenerDisable_PortPrompt Port number of TCP/IP Listener to start:
# PortsUDPSet command
CMD_PortsUDPSet Sets the UDP ports that the server should listen on
CMD_PortsUDPSet_Help This command can be used to specify a single or multiple UDP ports the server should listen on. \nYou can specify a port that is used by another process, however the server will not be able to use it until the port becomes free. \nSpecify a port number that is within the range of 1 to 65535. \nYou can list the ports that are currently set with the PortsUDPGet command. \nTo execute this command, you must have VPN Server administrator privileges.
CMD_PortsUDPSet_Args PortsUDPSet [ports]
CMD_PortsUDPSet_[ports] Multiple UDP ports can be specified by splitting them with a space or a comma, for example: "443, 992, 1194, 5555". \nSpecify "0" to disable the UDP listener. \n\nPorts:
# PortsUDPGet command
CMD_PortsUDPGet Lists the UDP ports that the server is listening on
CMD_PortsUDPGet_Help This command can be used to retrieve the UDP ports the server is listening on. \nYou can set the ports with the PortsUDPSet command.
CMD_PortsUDPGet_Args PortsUDPGet
CMD_PortsUDPGet_Ports UDP ports
# ServerPasswordSet command
CMD_ServerPasswordSet Set VPN Server Administrator Password
CMD_ServerPasswordSet_Help This sets the VPN Server administrator password. You can specify the password as a parameter. If the password is not specified, a prompt will be displayed to input the password and password confirmation. If you include the password as a parameter, this password will be displayed momentarily on the screen, which poses a risk. We recommend that whenever possible, avoid specifying this parameter and input the password using the password prompt. \nTo execute this command, you must have VPN Server administrator privileges.

View File

@ -4568,6 +4568,20 @@ CMD_ListenerDisable_[port] 使用一個整數,指定要停止的 TCP/IP 監聽
CMD_ListenerDisable_PortPrompt 啟動 TCP/IP 監聽器埠號:
# PortsUDPSet command
CMD_PortsUDPSet Sets the UDP ports that the server should listen on
CMD_PortsUDPSet_Help This command can be used to specify a single or multiple UDP ports the server should listen on. \nYou can specify a port that is used by another process, however the server will not be able to use it until the port becomes free. \nSpecify a port number that is within the range of 1 to 65535. \nYou can list the ports that are currently set with the PortsUDPGet command. \nTo execute this command, you must have VPN Server administrator privileges.
CMD_PortsUDPSet_Args PortsUDPSet [ports]
CMD_PortsUDPSet_[ports] Multiple UDP ports can be specified by splitting them with a space or a comma, for example: "443, 992, 1194, 5555". \nSpecify "0" to disable the UDP listener. \n\nPorts:
# PortsUDPGet command
CMD_PortsUDPGet Lists the UDP ports that the server is listening on
CMD_PortsUDPGet_Help This command can be used to retrieve the UDP ports the server is listening on. \nYou can set the ports with the PortsUDPSet command.
CMD_PortsUDPGet_Args PortsUDPGet
CMD_PortsUDPGet_Ports UDP ports
# ServerPasswordSet 命令
CMD_ServerPasswordSet 設置 VPN Server 管理員密碼
CMD_ServerPasswordSet_Help 這將設置 VPN Server 管理員密碼。您可以指定密碼為一個參數。如果密碼沒有指定,將顯示提示輸入密碼和密碼確認。如果指定密碼為一個參數,這個密碼將在螢幕上顯示瞬間,這構成了風險。我們建議盡可能避免指定這個參數,使用密碼提示輸入密碼。\n為了執行這個命令您必須有 VPN Server 管理員許可權。