File tree Expand file tree Collapse file tree 4 files changed +12
-0
lines changed Expand file tree Collapse file tree 4 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -138,6 +138,7 @@ You can customize the values of the helm deployment by using the following Value
138
138
| ` configuration.Users[].Username ` | Set the user's username | N/A |
139
139
| ` configuration.Users[].Password ` | Set the user's password. If empty or ` null ` , password authentication is disabled | N/A |
140
140
| ` configuration.Users[].PasswordIsEncrypted ` | ` true ` or ` false ` . Indicates if the password value is already encrypted | ` false ` |
141
+ | ` configuration.Users[].AllowedHosts ` | Set the user's allowed hosts. If empty, any host is allowed | ` [] ` |
141
142
| ` configuration.Users[].PublicKeys ` | Set the user's public keys | ` [] ` |
142
143
| ` configuration.Users[].UID ` | Sets the user's UID. | ` null ` |
143
144
| ` configuration.Users[].GID ` | Sets the user's GID. A group is created for this value and the user is included | ` null ` |
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ public class UserDefinition
7
7
public string Username { get ; set ; }
8
8
public string Password { get ; set ; }
9
9
public bool PasswordIsEncrypted { get ; set ; }
10
+ public List < string > AllowedHosts { get ; set ; } = new List < string > ( ) ;
10
11
11
12
// ReSharper disable once InconsistentNaming
12
13
public int ? UID { get ; set ; }
Original file line number Diff line number Diff line change @@ -7,6 +7,8 @@ public class SSHConfiguration
7
7
{
8
8
public List < MatchBlock > MatchBlocks { get ; } = new List < MatchBlock > ( ) ;
9
9
10
+ public List < string > AllowUsers { get ; } = new List < string > ( ) ;
11
+
10
12
public override string ToString ( )
11
13
{
12
14
var builder = new StringBuilder ( ) ;
@@ -29,6 +31,8 @@ public override string ToString()
29
31
builder . AppendLine ( "# Subsystem" ) ;
30
32
builder . AppendLine ( "Subsystem sftp internal-sftp" ) ;
31
33
builder . AppendLine ( ) ;
34
+ builder . AppendLine ( "# Allowed users" ) ;
35
+ builder . AppendLine ( $ "AllowUsers { System . String . Join ( " " , AllowUsers ) } ") ;
32
36
builder . AppendLine ( ) ;
33
37
builder . AppendLine ( "# Match blocks" ) ;
34
38
foreach ( var matchBlock in MatchBlocks )
Original file line number Diff line number Diff line change @@ -70,6 +70,12 @@ private async Task UpdateConfiguration()
70
70
"AllowTcpForwarding no"
71
71
} ;
72
72
73
+ sshdConfig . AllowUsers . AddRange ( sftpConfig . Users . Select ( s =>
74
+ s . AllowedHosts . Any ( )
75
+ ? $ "{ s . Username } @{ String . Join ( "," , s . AllowedHosts ) } "
76
+ : s . Username )
77
+ ) ;
78
+
73
79
sshdConfig . MatchBlocks . AddRange ( exceptionalUsers . Select ( s => new MatchBlock
74
80
{
75
81
Criteria = MatchBlock . MatchCriteria . User ,
You can’t perform that action at this time.
0 commit comments