mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 16:40:24 +08:00 
			
		
		
		
	Implement the ability to change the ssh port to match what is in the gitea config (#7286)
* - rearrange the templates to make it more logical because now ssh_config is a template - implemented the updating of the port to the same as the port sent to the gitea config * change the filename back
This commit is contained in:
		
				
					committed by
					
						
						techknowlogick
					
				
			
			
				
	
			
			
			
						parent
						
							b282d4e121
						
					
				
				
					commit
					75d4414386
				
			@@ -24,6 +24,13 @@ if [ ! -f /data/ssh/ssh_host_ecdsa_key ]; then
 | 
				
			|||||||
    ssh-keygen -t ecdsa -b 256 -f /data/ssh/ssh_host_ecdsa_key -N "" > /dev/null
 | 
					    ssh-keygen -t ecdsa -b 256 -f /data/ssh/ssh_host_ecdsa_key -N "" > /dev/null
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if [ -d /etc/ssh ]; then
 | 
				
			||||||
 | 
					    SSH_PORT=${SSH_PORT:-"22"} \
 | 
				
			||||||
 | 
					    envsubst < /etc/templates/sshd_config > /etc/ssh/sshd_config
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    chmod 0644 /etc/ssh/sshd_config
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
chown root:root /data/ssh/*
 | 
					chown root:root /data/ssh/*
 | 
				
			||||||
chmod 0700 /data/ssh
 | 
					chmod 0700 /data/ssh
 | 
				
			||||||
chmod 0600 /data/ssh/*
 | 
					chmod 0600 /data/ssh/*
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
Port 22
 | 
					Port ${SSH_PORT}
 | 
				
			||||||
Protocol 2
 | 
					Protocol 2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
AddressFamily any
 | 
					AddressFamily any
 | 
				
			||||||
		Reference in New Issue
	
	Block a user