Skip to content

Commit

Permalink
v0.3 + Re-creating SSH keys (changing server password, etc.)
Browse files Browse the repository at this point in the history
  • Loading branch information
AKotov-dev committed Sep 9, 2024
1 parent 19b2194 commit b3607aa
Show file tree
Hide file tree
Showing 21 changed files with 157 additions and 119 deletions.
2 changes: 1 addition & 1 deletion sshuttle-gui/backup/pingtrd.pas
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ procedure CheckPing.Execute;
end;
end;

//Индикация - светодиод
//Индикация: Cветодиод, Режим
procedure CheckPing.ShowStatus;
begin
with MainForm do
Expand Down
2 changes: 1 addition & 1 deletion sshuttle-gui/backup/sshuttle_gui.lpi
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<Version Value="12"/>
<General>
<SessionStorage Value="InProjectDir"/>
<Title Value="SShuttle-GUI v0.1"/>
<Title Value="SShuttle-GUI v0.3"/>
<Scaled Value="True"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>
Expand Down
4 changes: 2 additions & 2 deletions sshuttle-gui/backup/sshuttle_gui.lpr
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

begin
RequireDerivedFormResource := True;
Application.Title := 'SShuttle-GUI v0.1';
Application.Scaled := True;
Application.Title:='SShuttle-GUI v0.3';
Application.Scaled:=True;
Application.Initialize;
Application.CreateForm(TMainForm, MainForm);
Application.Run;
Expand Down
24 changes: 16 additions & 8 deletions sshuttle-gui/backup/sshuttle_gui.lps
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<Filename Value="sshuttle_gui.lpr"/>
<IsPartOfProject Value="True"/>
<EditorIndex Value="1"/>
<UsageCount Value="37"/>
<UsageCount Value="38"/>
<Loaded Value="True"/>
</Unit>
<Unit>
Expand All @@ -49,20 +49,20 @@
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="Unit1"/>
<IsVisibleTab Value="True"/>
<TopLine Value="144"/>
<CursorPos X="29" Y="146"/>
<UsageCount Value="37"/>
<CursorPos X="68" Y="9"/>
<ComponentState Value="1"/>
<UsageCount Value="38"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit>
<Unit>
<Filename Value="pingtrd.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="PingTRD"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="2"/>
<CursorPos X="33" Y="59"/>
<UsageCount Value="33"/>
<CursorPos X="15"/>
<UsageCount Value="34"/>
<Loaded Value="True"/>
</Unit>
<Unit>
Expand All @@ -73,7 +73,7 @@
<UsageCount Value="35"/>
</Unit>
</Units>
<JumpHistory HistoryIndex="27">
<JumpHistory HistoryIndex="29">
<Position>
<Filename Value="unit1.pas"/>
<Caret Line="189" Column="20" TopLine="167"/>
Expand Down Expand Up @@ -186,6 +186,14 @@
<Filename Value="unit1.pas"/>
<Caret Line="149" Column="76" TopLine="144"/>
</Position>
<Position>
<Filename Value="unit1.pas"/>
<Caret Line="154" Column="28" TopLine="144"/>
</Position>
<Position>
<Filename Value="unit1.pas"/>
<Caret Line="190" Column="78" TopLine="174"/>
</Position>
</JumpHistory>
<RunParams>
<FormatVersion Value="2"/>
Expand Down
22 changes: 11 additions & 11 deletions sshuttle-gui/backup/unit1.lfm
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
object MainForm: TMainForm
Left = 263
Height = 175
Top = 126
Left = 287
Height = 189
Top = 125
Width = 531
Caption = 'SShuttle-GUI'
ClientHeight = 175
ClientHeight = 189
ClientWidth = 531
OnCreate = FormCreate
OnShow = FormShow
SessionProperties = 'IPv6Box.Checked;LatencyBox.Checked;Left;PasswordEdit.Text;PortEdit.Text;RouterEdit.Text;ServerEdit.Text;Top;UserEdit.Text'
LCLVersion = '2.2.4.0'
LCLVersion = '3.2.0.0'
object Label1: TLabel
AnchorSideTop.Side = asrCenter
Left = 8
Expand Down Expand Up @@ -87,13 +87,13 @@ object MainForm: TMainForm
AnchorSideRight.Side = asrBottom
Left = 283
Height = 32
Top = 134
Top = 135
Width = 242
Anchors = [akTop, akRight]
BorderSpacing.Right = 6
Caption = 'Clear browser cookies on start GUI'
OnChange = ClearBoxChange
TabOrder = 7
OnChange = ClearBoxChange
end
object AutoStartBox: TCheckBox
AnchorSideLeft.Control = StartBtn
Expand All @@ -107,8 +107,8 @@ object MainForm: TMainForm
Anchors = [akTop, akRight]
BorderSpacing.Right = 6
Caption = 'Autostart VPN on reboot'
OnChange = AutoStartBoxChange
TabOrder = 5
OnChange = AutoStartBoxChange
end
object StartBtn: TSpeedButton
AnchorSideLeft.Control = Shape1
Expand All @@ -134,7 +134,7 @@ object MainForm: TMainForm
object StaticText1: TStaticText
Left = 0
Height = 20
Top = 155
Top = 169
Width = 531
Align = alBottom
BorderStyle = sbsSingle
Expand Down Expand Up @@ -205,9 +205,9 @@ object MainForm: TMainForm
AnchorSideTop.Side = asrBottom
Left = 8
Height = 32
Top = 134
Top = 135
Width = 161
BorderSpacing.Top = 2
BorderSpacing.Top = 3
Caption = '--no-latency-control'
Checked = True
State = cbChecked
Expand Down
74 changes: 41 additions & 33 deletions sshuttle-gui/backup/unit1.pas
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ implementation

uses pingtrd;

{$R *.lfm}
{$R *.lfm}

{ TMainForm }
{ TMainForm }

//Общая процедура запуска команд (асинхронная)
procedure TMainForm.StartProcess(command: string);
Expand Down Expand Up @@ -178,37 +178,45 @@ procedure TMainForm.StartBtnClick(Sender: TObject);
StartProcess('systemctl stop sshuttle.service');
end
else
try
S := TStringList.Create;

S.Add('#!/bin/bash');
S.Add('');

//Содаём пускач для systemd (Type=simple)
S.Add('# Проверка наличия валидных ключей /root/.ssh/{known_hosts,known_hosts.old}');
S.Add('if [[ ! -f /root/.ssh/known_hosts.old ]] || [[ -z $(ssh-keygen -F ' +
Trim(ServerEDit.Text) + ') ]]; then');
S.Add('sshpass -p "' + Trim(PasswordEdit.Text) +
'" ssh -o StrictHostKeyChecking=No ' + Trim(UserEdit.Text) +
'@' + Trim(ServerEDit.Text) + ' -p ' + Trim(PortEdit.Text) + ' exit 0; fi');
S.Add('');
S.Add('# Запуск vpn');
S.Add('[[ "$?" -eq "0" ]] && \');
S.Add('sshpass -p "' + Trim(PasswordEdit.Text) +
'" sshuttle --dns --remote ' + Trim(UserEdit.Text) + '@' +
Trim(ServerEDit.Text) + ':' + Trim(PortEdit.Text) + ' -x ' +
Trim(ServerEDit.Text) + ':' + Trim(PortEdit.Text) + ' 0/0 ' + Trim(Pars));

S.Add('exit 0;');

S.SaveToFile('/etc/sshuttle-gui/connect.sh');

//Запускаем скрипт через systemd
StartProcess('chmod +x /etc/sshuttle-gui/connect.sh; systemctl restart sshuttle.service');

finally
S.Free;
end;
try
S := TStringList.Create;

S.Add('#!/bin/bash');
S.Add('');

//Содаём пускач для systemd (Type=simple)
S.Add('# Проверка наличия валидных ключей /root/.ssh/{known_hosts,known_hosts.old}');

//Очистка прежних ключей (мог измениться пароль или хост)
S.Add('sed -i "/^' + Trim(ServerEDit.Text) + '/d" /root/.ssh/known_hosts');

{ S.Add('if [[ ! -f /root/.ssh/known_hosts.old ]] || [[ -z $(ssh-keygen -F ' +
Trim(ServerEDit.Text) + ') ]]; then'); }

S.Add('sshpass -p "' + Trim(PasswordEdit.Text) +
'" ssh -o StrictHostKeyChecking=No ' + Trim(UserEdit.Text) +
// '@' + Trim(ServerEDit.Text) + ' -p ' + Trim(PortEdit.Text) + ' exit 0; fi');
'@' + Trim(ServerEDit.Text) + ' -p ' + Trim(PortEdit.Text) + ' exit 0');

S.Add('');

S.Add('# Запуск vpn');
S.Add('[[ "$?" -eq "0" ]] && \');
S.Add('sshpass -p "' + Trim(PasswordEdit.Text) + '" sshuttle --dns --remote ' +
Trim(UserEdit.Text) + '@' + Trim(ServerEDit.Text) + ':' +
Trim(PortEdit.Text) + ' -x ' + Trim(ServerEDit.Text) + ':' +
Trim(PortEdit.Text) + ' 0/0 ' + Trim(Pars));

S.Add('exit 0;');

S.SaveToFile('/etc/sshuttle-gui/connect.sh');

//Запускаем скрипт через systemd
StartProcess('chmod +x /etc/sshuttle-gui/connect.sh; systemctl restart sshuttle.service');

finally
S.Free;
end;
end;


Expand Down
Binary file modified sshuttle-gui/lib/x86_64-linux/pingtrd.o
Binary file not shown.
Binary file modified sshuttle-gui/lib/x86_64-linux/pingtrd.ppu
Binary file not shown.
Binary file modified sshuttle-gui/lib/x86_64-linux/sshuttle_gui.o
Binary file not shown.
Binary file modified sshuttle-gui/lib/x86_64-linux/sshuttle_gui.or
Binary file not shown.
6 changes: 3 additions & 3 deletions sshuttle-gui/lib/x86_64-linux/unit1.lfm
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ object MainForm: TMainForm
OnCreate = FormCreate
OnShow = FormShow
SessionProperties = 'IPv6Box.Checked;LatencyBox.Checked;Left;PasswordEdit.Text;PortEdit.Text;RouterEdit.Text;ServerEdit.Text;Top;UserEdit.Text'
LCLVersion = '2.2.4.0'
LCLVersion = '3.2.0.0'
object Label1: TLabel
AnchorSideTop.Side = asrCenter
Left = 8
Expand Down Expand Up @@ -92,8 +92,8 @@ object MainForm: TMainForm
Anchors = [akTop, akRight]
BorderSpacing.Right = 6
Caption = 'Clear browser cookies on start GUI'
OnChange = ClearBoxChange
TabOrder = 7
OnChange = ClearBoxChange
end
object AutoStartBox: TCheckBox
AnchorSideLeft.Control = StartBtn
Expand All @@ -107,8 +107,8 @@ object MainForm: TMainForm
Anchors = [akTop, akRight]
BorderSpacing.Right = 6
Caption = 'Autostart VPN on reboot'
OnChange = AutoStartBoxChange
TabOrder = 5
OnChange = AutoStartBoxChange
end
object StartBtn: TSpeedButton
AnchorSideLeft.Control = Shape1
Expand Down
Binary file modified sshuttle-gui/lib/x86_64-linux/unit1.o
Binary file not shown.
Binary file modified sshuttle-gui/lib/x86_64-linux/unit1.ppu
Binary file not shown.
21 changes: 13 additions & 8 deletions sshuttle-gui/package-project/sshuttle-gui.prj
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
name=sshuttle-gui

[VERSION]
version=0.2
version=0.3

[RELEASE]
release=0.mrx9

[GROUP]
group=Applications/System
group=Networking/Other

[DESCRIPTION]
0=GUI for SShuttle - Transparent proxy server that works as a poor man's VPN. Forwards over ssh.
Expand Down Expand Up @@ -67,11 +67,16 @@ programname=SShuttle-GUI
devtool=Lazarus

[TOOLVERSION]
toolversion=2.2.4
toolversion=3.2

[INFO]
0=v0.2
1=+ Improved startup sshuttle.service
2=+ RPM-packages for Mageia-8, ROSA Linux and Mageia-9
3=
4=v0.1 - initial release
0=v0.3
1=+ Recompiling in Lazarus 3.2
2=+ Re-creating SSH keys (changing server password, etc.)
3=+ RPM-packages for Mageia-9 and Ubuntu
4=
5=v0.2
6=+ Improved startup sshuttle.service
7=+ RPM-packages for Mageia-8, ROSA Linux and Mageia-9
8=
9=v0.1 - initial release
4 changes: 2 additions & 2 deletions sshuttle-gui/pingtrd.pas
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ implementation

uses unit1;

{ TRD }
{ TRD }

procedure CheckPing.Execute;
var
Expand Down Expand Up @@ -75,7 +75,7 @@ procedure CheckPing.ShowStatus;
begin
StartBtn.Caption := SStart;
Shape1.Brush.Color := clYellow;
end;
end;

Shape1.Repaint;
StartBtn.Repaint;
Expand Down
Binary file modified sshuttle-gui/sshuttle_gui
Binary file not shown.
2 changes: 1 addition & 1 deletion sshuttle-gui/sshuttle_gui.lpi
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<Version Value="12"/>
<General>
<SessionStorage Value="InProjectDir"/>
<Title Value="SShuttle-GUI v0.2"/>
<Title Value="SShuttle-GUI v0.3"/>
<Scaled Value="True"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>
Expand Down
12 changes: 6 additions & 6 deletions sshuttle-gui/sshuttle_gui.lpr
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@
{$mode objfpc}{$H+}

uses
{$IFDEF UNIX}
{$IFDEF UNIX}
cthreads,
{$ENDIF} {$IFDEF HASAMIGA}
{$ENDIF}{$IFDEF HASAMIGA}
athreads,
{$ENDIF}
{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms,
Unit1,
PingTRD { you can add units after this };

{$R *.res}
{$R *.res}

begin
RequireDerivedFormResource := True;
Application.Title:='SShuttle-GUI v0.2';
Application.Scaled:=True;
Application.Title := 'SShuttle-GUI v0.3';
Application.Scaled := True;
Application.Initialize;
Application.CreateForm(TMainForm, MainForm);
Application.Run;
Expand Down
Loading

0 comments on commit b3607aa

Please sign in to comment.