Skip to content

Commit b3607aa

Browse files
committed
v0.3 + Re-creating SSH keys (changing server password, etc.)
1 parent 19b2194 commit b3607aa

21 files changed

+157
-119
lines changed

sshuttle-gui/backup/pingtrd.pas

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ procedure CheckPing.Execute;
6161
end;
6262
end;
6363

64-
//Индикация - светодиод
64+
//Индикация: Cветодиод, Режим
6565
procedure CheckPing.ShowStatus;
6666
begin
6767
with MainForm do

sshuttle-gui/backup/sshuttle_gui.lpi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<Version Value="12"/>
55
<General>
66
<SessionStorage Value="InProjectDir"/>
7-
<Title Value="SShuttle-GUI v0.1"/>
7+
<Title Value="SShuttle-GUI v0.3"/>
88
<Scaled Value="True"/>
99
<ResourceType Value="res"/>
1010
<UseXPManifest Value="True"/>

sshuttle-gui/backup/sshuttle_gui.lpr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717

1818
begin
1919
RequireDerivedFormResource := True;
20-
Application.Title := 'SShuttle-GUI v0.1';
21-
Application.Scaled := True;
20+
Application.Title:='SShuttle-GUI v0.3';
21+
Application.Scaled:=True;
2222
Application.Initialize;
2323
Application.CreateForm(TMainForm, MainForm);
2424
Application.Run;

sshuttle-gui/backup/sshuttle_gui.lps

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
<Filename Value="sshuttle_gui.lpr"/>
4040
<IsPartOfProject Value="True"/>
4141
<EditorIndex Value="1"/>
42-
<UsageCount Value="37"/>
42+
<UsageCount Value="38"/>
4343
<Loaded Value="True"/>
4444
</Unit>
4545
<Unit>
@@ -49,20 +49,20 @@
4949
<HasResources Value="True"/>
5050
<ResourceBaseClass Value="Form"/>
5151
<UnitName Value="Unit1"/>
52-
<IsVisibleTab Value="True"/>
53-
<TopLine Value="144"/>
54-
<CursorPos X="29" Y="146"/>
55-
<UsageCount Value="37"/>
52+
<CursorPos X="68" Y="9"/>
53+
<ComponentState Value="1"/>
54+
<UsageCount Value="38"/>
5655
<Loaded Value="True"/>
5756
<LoadedDesigner Value="True"/>
5857
</Unit>
5958
<Unit>
6059
<Filename Value="pingtrd.pas"/>
6160
<IsPartOfProject Value="True"/>
6261
<UnitName Value="PingTRD"/>
62+
<IsVisibleTab Value="True"/>
6363
<EditorIndex Value="2"/>
64-
<CursorPos X="33" Y="59"/>
65-
<UsageCount Value="33"/>
64+
<CursorPos X="15"/>
65+
<UsageCount Value="34"/>
6666
<Loaded Value="True"/>
6767
</Unit>
6868
<Unit>
@@ -73,7 +73,7 @@
7373
<UsageCount Value="35"/>
7474
</Unit>
7575
</Units>
76-
<JumpHistory HistoryIndex="27">
76+
<JumpHistory HistoryIndex="29">
7777
<Position>
7878
<Filename Value="unit1.pas"/>
7979
<Caret Line="189" Column="20" TopLine="167"/>
@@ -186,6 +186,14 @@
186186
<Filename Value="unit1.pas"/>
187187
<Caret Line="149" Column="76" TopLine="144"/>
188188
</Position>
189+
<Position>
190+
<Filename Value="unit1.pas"/>
191+
<Caret Line="154" Column="28" TopLine="144"/>
192+
</Position>
193+
<Position>
194+
<Filename Value="unit1.pas"/>
195+
<Caret Line="190" Column="78" TopLine="174"/>
196+
</Position>
189197
</JumpHistory>
190198
<RunParams>
191199
<FormatVersion Value="2"/>

sshuttle-gui/backup/unit1.lfm

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
object MainForm: TMainForm
2-
Left = 263
3-
Height = 175
4-
Top = 126
2+
Left = 287
3+
Height = 189
4+
Top = 125
55
Width = 531
66
Caption = 'SShuttle-GUI'
7-
ClientHeight = 175
7+
ClientHeight = 189
88
ClientWidth = 531
99
OnCreate = FormCreate
1010
OnShow = FormShow
1111
SessionProperties = 'IPv6Box.Checked;LatencyBox.Checked;Left;PasswordEdit.Text;PortEdit.Text;RouterEdit.Text;ServerEdit.Text;Top;UserEdit.Text'
12-
LCLVersion = '2.2.4.0'
12+
LCLVersion = '3.2.0.0'
1313
object Label1: TLabel
1414
AnchorSideTop.Side = asrCenter
1515
Left = 8
@@ -87,13 +87,13 @@ object MainForm: TMainForm
8787
AnchorSideRight.Side = asrBottom
8888
Left = 283
8989
Height = 32
90-
Top = 134
90+
Top = 135
9191
Width = 242
9292
Anchors = [akTop, akRight]
9393
BorderSpacing.Right = 6
9494
Caption = 'Clear browser cookies on start GUI'
95-
OnChange = ClearBoxChange
9695
TabOrder = 7
96+
OnChange = ClearBoxChange
9797
end
9898
object AutoStartBox: TCheckBox
9999
AnchorSideLeft.Control = StartBtn
@@ -107,8 +107,8 @@ object MainForm: TMainForm
107107
Anchors = [akTop, akRight]
108108
BorderSpacing.Right = 6
109109
Caption = 'Autostart VPN on reboot'
110-
OnChange = AutoStartBoxChange
111110
TabOrder = 5
111+
OnChange = AutoStartBoxChange
112112
end
113113
object StartBtn: TSpeedButton
114114
AnchorSideLeft.Control = Shape1
@@ -134,7 +134,7 @@ object MainForm: TMainForm
134134
object StaticText1: TStaticText
135135
Left = 0
136136
Height = 20
137-
Top = 155
137+
Top = 169
138138
Width = 531
139139
Align = alBottom
140140
BorderStyle = sbsSingle
@@ -205,9 +205,9 @@ object MainForm: TMainForm
205205
AnchorSideTop.Side = asrBottom
206206
Left = 8
207207
Height = 32
208-
Top = 134
208+
Top = 135
209209
Width = 161
210-
BorderSpacing.Top = 2
210+
BorderSpacing.Top = 3
211211
Caption = '--no-latency-control'
212212
Checked = True
213213
State = cbChecked

sshuttle-gui/backup/unit1.pas

Lines changed: 41 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ implementation
5454

5555
uses pingtrd;
5656

57-
{$R *.lfm}
57+
{$R *.lfm}
5858

59-
{ TMainForm }
59+
{ TMainForm }
6060

6161
//Общая процедура запуска команд (асинхронная)
6262
procedure TMainForm.StartProcess(command: string);
@@ -178,37 +178,45 @@ procedure TMainForm.StartBtnClick(Sender: TObject);
178178
StartProcess('systemctl stop sshuttle.service');
179179
end
180180
else
181-
try
182-
S := TStringList.Create;
183-
184-
S.Add('#!/bin/bash');
185-
S.Add('');
186-
187-
//Содаём пускач для systemd (Type=simple)
188-
S.Add('# Проверка наличия валидных ключей /root/.ssh/{known_hosts,known_hosts.old}');
189-
S.Add('if [[ ! -f /root/.ssh/known_hosts.old ]] || [[ -z $(ssh-keygen -F ' +
190-
Trim(ServerEDit.Text) + ') ]]; then');
191-
S.Add('sshpass -p "' + Trim(PasswordEdit.Text) +
192-
'" ssh -o StrictHostKeyChecking=No ' + Trim(UserEdit.Text) +
193-
'@' + Trim(ServerEDit.Text) + ' -p ' + Trim(PortEdit.Text) + ' exit 0; fi');
194-
S.Add('');
195-
S.Add('# Запуск vpn');
196-
S.Add('[[ "$?" -eq "0" ]] && \');
197-
S.Add('sshpass -p "' + Trim(PasswordEdit.Text) +
198-
'" sshuttle --dns --remote ' + Trim(UserEdit.Text) + '@' +
199-
Trim(ServerEDit.Text) + ':' + Trim(PortEdit.Text) + ' -x ' +
200-
Trim(ServerEDit.Text) + ':' + Trim(PortEdit.Text) + ' 0/0 ' + Trim(Pars));
201-
202-
S.Add('exit 0;');
203-
204-
S.SaveToFile('/etc/sshuttle-gui/connect.sh');
205-
206-
//Запускаем скрипт через systemd
207-
StartProcess('chmod +x /etc/sshuttle-gui/connect.sh; systemctl restart sshuttle.service');
208-
209-
finally
210-
S.Free;
211-
end;
181+
try
182+
S := TStringList.Create;
183+
184+
S.Add('#!/bin/bash');
185+
S.Add('');
186+
187+
//Содаём пускач для systemd (Type=simple)
188+
S.Add('# Проверка наличия валидных ключей /root/.ssh/{known_hosts,known_hosts.old}');
189+
190+
//Очистка прежних ключей (мог измениться пароль или хост)
191+
S.Add('sed -i "/^' + Trim(ServerEDit.Text) + '/d" /root/.ssh/known_hosts');
192+
193+
{ S.Add('if [[ ! -f /root/.ssh/known_hosts.old ]] || [[ -z $(ssh-keygen -F ' +
194+
Trim(ServerEDit.Text) + ') ]]; then'); }
195+
196+
S.Add('sshpass -p "' + Trim(PasswordEdit.Text) +
197+
'" ssh -o StrictHostKeyChecking=No ' + Trim(UserEdit.Text) +
198+
// '@' + Trim(ServerEDit.Text) + ' -p ' + Trim(PortEdit.Text) + ' exit 0; fi');
199+
'@' + Trim(ServerEDit.Text) + ' -p ' + Trim(PortEdit.Text) + ' exit 0');
200+
201+
S.Add('');
202+
203+
S.Add('# Запуск vpn');
204+
S.Add('[[ "$?" -eq "0" ]] && \');
205+
S.Add('sshpass -p "' + Trim(PasswordEdit.Text) + '" sshuttle --dns --remote ' +
206+
Trim(UserEdit.Text) + '@' + Trim(ServerEDit.Text) + ':' +
207+
Trim(PortEdit.Text) + ' -x ' + Trim(ServerEDit.Text) + ':' +
208+
Trim(PortEdit.Text) + ' 0/0 ' + Trim(Pars));
209+
210+
S.Add('exit 0;');
211+
212+
S.SaveToFile('/etc/sshuttle-gui/connect.sh');
213+
214+
//Запускаем скрипт через systemd
215+
StartProcess('chmod +x /etc/sshuttle-gui/connect.sh; systemctl restart sshuttle.service');
216+
217+
finally
218+
S.Free;
219+
end;
212220
end;
213221

214222

0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
80 Bytes
Binary file not shown.
23.9 KB
Binary file not shown.

0 commit comments

Comments
 (0)