[aurweb,v2] Source valid ssh prefixes from config

Message ID 20210610184623.517279-1-void@fluix.one
State New
Headers show
Series [aurweb,v2] Source valid ssh prefixes from config | expand

Commit Message

Steven Guikal June 10, 2021, 6:46 p.m. UTC
---

Old patch didn't apply because it had some local changes.

 web/lib/acctfuncs.inc.php | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

Eli Schwartz June 10, 2021, 7:34 p.m. UTC | #1
On 6/10/21 2:46 PM, Steven Guikal via aur-dev wrote:
> ---
> 
> Old patch didn't apply because it had some local changes.


Great cleanup, thanks!

To gitlab.archlinux.org:archlinux/aurweb.git
   f9f41dc9..a625df07  master -> master


>  web/lib/acctfuncs.inc.php | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/web/lib/acctfuncs.inc.php b/web/lib/acctfuncs.inc.php
> index df016c6d..0d021f99 100644
> --- a/web/lib/acctfuncs.inc.php
> +++ b/web/lib/acctfuncs.inc.php
> @@ -875,10 +875,7 @@ function valid_pgp_fingerprint($fingerprint) {
>   * @return bool True if the SSH public key is valid, otherwise false
>   */
>  function valid_ssh_pubkey($pubkey) {
> -	$valid_prefixes = array(
> -		"ssh-rsa", "ssh-dss", "ecdsa-sha2-nistp256",
> -		"ecdsa-sha2-nistp384", "ecdsa-sha2-nistp521", "ssh-ed25519"
> -	);
> +	$valid_prefixes = explode(' ', config_get('auth', 'valid-keytypes'));
>  
>  	$has_valid_prefix = false;
>  	foreach ($valid_prefixes as $prefix) {
>

Patch

diff --git a/web/lib/acctfuncs.inc.php b/web/lib/acctfuncs.inc.php
index df016c6d..0d021f99 100644
--- a/web/lib/acctfuncs.inc.php
+++ b/web/lib/acctfuncs.inc.php
@@ -875,10 +875,7 @@  function valid_pgp_fingerprint($fingerprint) {
  * @return bool True if the SSH public key is valid, otherwise false
  */
 function valid_ssh_pubkey($pubkey) {
-	$valid_prefixes = array(
-		"ssh-rsa", "ssh-dss", "ecdsa-sha2-nistp256",
-		"ecdsa-sha2-nistp384", "ecdsa-sha2-nistp521", "ssh-ed25519"
-	);
+	$valid_prefixes = explode(' ', config_get('auth', 'valid-keytypes'));
 
 	$has_valid_prefix = false;
 	foreach ($valid_prefixes as $prefix) {