2024-01-25 16:19:03 +00:00
<! DOCTYPE html >
<!--
This program is free software : you can redistribute it and / or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation , either version 3 of the License , or ( at your option ) any later version .
This program is distributed in the hope that it will be useful , but WITHOUT ANY WARRANTY ; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the GNU Affero General Public License for more details .
You should have received a copy of the GNU Affero General Public License along with this program . If not , see < https :// www . gnu . org / licenses />.
-->
< html lang = " tr " >
< head >
< meta name = " viewport " content = " width=device-width " >
< meta charset = " UTF-8 " >
2024-01-28 10:43:27 +00:00
< meta name = " description " content = " ~vern'e kayı t ol " >
2024-01-25 16:19:03 +00:00
< link rel = " preload " href = " //gcdn.vern.cc/vernsite/style.css " >
< link rel = " stylesheet " href = " //gcdn.vern.cc/vernsite/style.css " >
< title > Kayı t | ~ vern </ title >
</ head >
< body >
2024-01-25 19:12:15 +00:00
<!-- #include file="nav.php" -->
2024-01-25 16:19:03 +00:00
2024-01-26 07:05:42 +00:00
< p >< b >~ vern kaydı için e - posta adresinizi paylaşamı yorsanı z ya da paylaşmak istemiyorsanı z , lütfen bir < a href =/ tur / admins > yöneticiyle </ a > iletişime geçin . Böylece size eposta olmadan bir hesap oluşturabiliriz .</ b ></ p >
2024-01-25 16:19:03 +00:00
< ? php
function sanitize ( $str ) {
$str = trim ( $str );
$str = stripslashes ( $str );
$str = htmlspecialchars ( $str );
$str = str_replace ( " \r " , '' , $str );
return $str ;
}
$success = false ;
$username = $email = $ssh = $reason =
$username_err = $email_err = $ssh_err = $reason_err = '' ;
$username_re = '/^[a-z_][a-z0-9_]{0,30}$/' ;
if ( $_SERVER [ 'REQUEST_METHOD' ] == " POST " ) {
if ( ! empty ( $_POST [ 'username' ])) {
if ( preg_match ( $username_re , $_POST [ 'username' ]) === 1 ) {
if ( ! file_exists ( '/vm/' . $_POST [ 'username' ])) {
if ( ! file_exists ( " /var/spool/register/ " . sanitize ( $_POST [ 'username' ])))
$username = sanitize ( $_POST [ 'username' ]);
2024-01-26 07:05:42 +00:00
else $username_err = " İstenilen kullanı cı adı " . $_POST [ 'username' ] . " zaten kullanı mda. Başka zaman tekrar deneyin ya da farklı kullanı cı adı seçin. " ;
2024-01-25 16:19:03 +00:00
}
else $username_err = " Kullanı cı adı zaten kullanı mda " ;
} else {
2024-01-25 19:12:15 +00:00
$username_err = " Geçersiz kullanı cı adı . Kullanı cı adı GNU/Linux formatı na uymak zorunda ( $username_re ) " ;
2024-01-25 16:19:03 +00:00
}
} else {
$username_err = " Kullanı cı adı gerekli " ;
}
if ( ! empty ( $_POST [ 'email' ])) {
if ( filter_var ( sanitize ( $_POST [ 'email' ]), FILTER_VALIDATE_EMAIL )) {
$email = sanitize ( $_POST [ 'email' ]);
} else {
2024-01-26 07:05:42 +00:00
$email_err = " Geçersiz E-posta " ;
2024-01-25 16:19:03 +00:00
}
} else {
2024-01-26 07:05:42 +00:00
$email_err = " E-posta gerekli " ;
2024-01-25 16:19:03 +00:00
}
if ( ! empty ( $_POST [ 'ssh' ])) {
$ret = shell_exec ( 'bash -c "ssh-keygen -lf - <<< ' . escapeshellarg ( $_POST [ 'ssh' ]) . ' 2>&1"' );
if ( trim ( $ret ) != " (stdin) is not a public key file. " ) {
$ssh = $_POST [ 'ssh' ];
} else {
2024-01-26 07:05:42 +00:00
$ssh_err = " Geçerli bir herkese açı k SSH anahtarı değil " ;
2024-01-25 16:19:03 +00:00
}
unset ( $ret );
} else {
2024-01-26 07:05:42 +00:00
$ssh_err = " Herkese açı k anahtar gerekli " ;
2024-01-25 16:19:03 +00:00
}
if ( ! empty ( $_POST [ 'joinreason' ])) {
$reason = $_POST [ 'joinreason' ];
} else {
2024-01-26 07:05:42 +00:00
$reason_err = " Katı lma sebebi gerekli " ;
2024-01-25 16:19:03 +00:00
}
if ( empty ( $username_err . $email_err . $ssh_err . $reason_err ) && isset ( $_POST [ 'tos' ]))
$success = true ;
}
if ( ! $success ) {
?>
< div class = h >< h1 id = signup > Kayı t Ol </ h1 > < a aria - hidden = true href = #signup>#signup</a></div>
2024-01-26 07:05:42 +00:00
< p >< a href = " //wiki.vern.cc/eng/guides/register/ " > Bu wiki sayfası </ a > size nası l kayı t olunucağı ndan bahseder .</ p >
2024-01-25 16:19:03 +00:00
< span class = " red " >* Gerekli alanlar </ span >
< form method = " post " action = " <?php echo htmlspecialchars( $_SERVER["PHP_SELF"] ); ?> " >
< p > Kullanı cı adı :
< input type = " text " name = " username " >
< span class = " red " >* < ? php echo $username_err ; ?> </span></p>
2024-01-26 07:05:42 +00:00
< p > E - posta ( sizinle iletişime geçmemiz için ) < span class = " red " >* < ? php echo $email_err ; ?> </span>
2024-01-25 16:19:03 +00:00
< input type = " text " name = " email " ></ p >
2024-01-26 07:05:42 +00:00
< p > Herkese açı k SSH anahtarı ( her satı rda bir anahtar ) < span class = " red " >* < ? php echo $ssh_err ; ?> </span><br>
2024-01-25 16:19:03 +00:00
< textarea name = " ssh " rows = " 3 " cols = " 50 " ></ textarea ></ p >
2024-01-26 07:05:42 +00:00
< p > Neden katı lmak istiyorsunuz ? < span class = " red " >* < ? php echo $reason_err ; ?> </span><br>
2024-01-25 16:19:03 +00:00
< textarea name = " joinreason " rows = " 8 " cols = " 50 " ></ textarea ></ p >
2024-01-26 07:05:42 +00:00
< p > Hangi servisleri istiyorsunuz ? ( Daha sonra servislerde bir hesap talep edebilirsiniz ) </ p >
2024-01-25 16:19:03 +00:00
< input type = " checkbox " id = " pubnix " name = " pubnix " value = " Pubnix " disabled checked >
2024-01-26 07:05:42 +00:00
< label for = " pubnix " > Pubnix ( E - Posta içerir ) </ label >< br >
2024-01-25 16:19:03 +00:00
< input type = " checkbox " id = " matrix " name = " matrix " value = " Matrix " checked >
< label for = " matrix " > Matrix </ label >< br >
< input type = " checkbox " id = " akkoma " name = " akkoma " value = " Akkoma " checked >
< label for = " akkoma " > Akkoma ( Pleroma Fork ) </ label >< br >
< input type = " checkbox " id = " soju " name = " soju " value = " Soju " checked >
< label for = " soju " > Soju </ label >< br >
< input type = " checkbox " id = " git " name = " git " value = " Forgejo " checked >
< label for = " git " > Forgejo </ label >< br >
< input type = " checkbox " id = " freshrss " name = " freshrss " value = " FreshRSS " checked >
< label for = " freshrss " > FreshRSS </ label >< br >
< input type = " checkbox " id = " miniflux " name = " miniflux " value = " Miniflux " checked >
< label for = " miniflux " > Miniflux </ label >< br >
< input type = " checkbox " id = " penpot " name = " penpot " value = " Penpot " checked >
< label for = " penpot " > Penpot </ label >< br >
< input type = " checkbox " id = " nextcloud " name = " nextcloud " value = " Nextcloud " checked >
< label for = " nextcloud " > Nextcloud </ label >< br >
< input type = " checkbox " id = " peertube " name = " peertube " value = " PeerTube " checked >
< label for = " peertube " > PeerTube </ label >< br >
< input type = " checkbox " id = " xmpp " name = " xmpp " value = " XMPP " checked >
< label for = " xmpp " > XMPP / Jabber </ label >< br >
< input type = " checkbox " id = " xmppo " name = " xmppo " value = " XMPP Onion " >
< label for = " xmppo " > XMPP / Jabber Onion ( Eğer bilmiyorsanı z olduğu gibi bı rakı n ) </ label >< br >
< input type = " checkbox " id = " xmppi " name = " xmppi " value = " XMPP I2P " >
< label for = " xmppi " > XMPP / Jabber I2P ( Eğer bilmiyorsanı z olduğu gibi bı rakı n ) </ label >< br >
< br >
< input type = " checkbox " id = " tos " name = " tos " value = " I agree to the ToS and Privacy Policy " >
2024-01-25 19:12:15 +00:00
< label for = " tos " >< a href =/ tur / tos > Kullanı m Şartları nı </ a > ve < a href =/ tur / privpol > Gizlilik Politikası nı </ a > okudum , anladı m ve onaylı yorum </ label >< br >
2024-01-25 16:19:03 +00:00
< br >
< span >< input type = " submit " value = " Submit " style = " width:100px;height:40px;font-size:20px " ></ span >
</ form >< br >
2024-01-26 19:52:24 +00:00
< p > HİZMET " OLDUĞU GİBİ " VE " MEVCUT OLDUĞU ŞEKİLDE " SUNULMAKTADIR VE HİZMETİN HER ZAMAN KULLANILABİLİR OLACAĞINI GARANTİ ETMİYORUZ , HİZMETİN VEYA HİZMET TARAFINDAN VEYA ~ VERN WEB SİTESİNDE SAĞLANAN HERHANGİ BİR MATERYALİN DOĞRULUĞU YÖNETİCİLER HİÇBİR DURUMDA HİZMET VEYA HİZMETTEKİ DİĞER İŞLEMLERİN KULLANILMASINDAN , HİZMETTEN VEYA HİZMETLE BAĞLANTILI OLARAK KAYNAKLANAN HERHANGİ BİR İDDİA , ZARAR VEYA DİĞER YÜKÜMLÜLÜKLERDEN SORUMLU OLMAYACAKTIR . HİZMETİ KULLANIMINIZDAN YALNIZCA SİZ SORUMLUSUNUZ .</ p >
2024-01-25 16:19:03 +00:00
< ? php
} else {
?>
< meta http - equiv = " refresh " content = " 5;url=/tur/ " />
< div class = h >< h1 id = thanks > Kayı t olduğunuz için teşekkürler .</ h1 > < a aria - hidden = true href = #thanks>#thanks</a></div>
2024-01-26 07:05:42 +00:00
< p > Bir yönetici isteğinizi onaylı cak , eğer kabul edilirseniz size bir e - posta gelecek .</ p >
< p > 5 saniye sonra < a href =/ tur /> ana sayfaya </ a > yönlendiriliceksiniz .</ p >
2024-01-25 16:19:03 +00:00
< ? php
if ( isset ( $_POST [ 'matrix' ])) $use_matrix = true ;
if ( isset ( $_POST [ 'akkoma' ])) $use_akkoma = true ;
if ( isset ( $_POST [ 'soju' ])) $use_soju = true ;
if ( isset ( $_POST [ 'git' ])) $use_git = true ;
if ( isset ( $_POST [ 'nextcloud' ])) $use_nc = true ;
if ( isset ( $_POST [ 'freshrss' ])) $use_freshrss = true ;
if ( isset ( $_POST [ 'miniflux' ])) $use_miniflux = true ;
if ( isset ( $_POST [ 'penpot' ])) $use_penpot = true ;
if ( isset ( $_POST [ 'peertube' ])) $use_peertube = true ;
if ( isset ( $_POST [ 'xmpp' ])) $use_xmpp = true ;
if ( isset ( $_POST [ 'xmppo' ])) $use_xmppo = true ;
if ( isset ( $_POST [ 'xmppi' ])) $use_xmppi = true ;
$to = " root@vern.cc " ;
2024-01-25 19:12:15 +00:00
$subject = " New registration request from $username < $email > " ;
2024-01-25 16:19:03 +00:00
$message = " Hello Administrators, \n Someone has requested a membership. Please view the details below and decide if it is worth approving. \n \n SSH keys: \n $ssh\n\nRequested username: $username\nRequested services: Tilde " ;
if ( $use_matrix ) $message .= " , Matrix " ;
if ( $use_akkoma ) $message .= " , Akkoma " ;
if ( $use_soju ) $message .= " , Soju " ;
if ( $use_git ) $message .= " , Forgejo " ;
if ( $use_nc ) $message .= " , Nextcloud " ;
if ( $use_freshrss ) $message .= " , FreshRSS " ;
if ( $use_miniflux ) $message .= " , Miniflux " ;
if ( $use_penpot ) $message .= " , Penpot " ;
if ( $use_peertube ) $message .= " , PeerTube " ;
if ( $use_xmpp ) $message .= " , XMPP " ;
if ( $use_xmppo ) $message .= " , XMPP Onion " ;
if ( $use_xmppi ) $message .= " , XMPP I2P " ;
$message .= " . \n Join reason: \n $reason\n\n\nTo accept this request, run this command as root: \n /root/bin/accept $username\nTo deny this request, run this command as root: \n /root/bin/deny $username\n " ;
$contents = " #!/usr/bin/env -S bash -e \n \n # This is the registration script for $username \n # This script was automatically generated by http:// " . $_SERVER [ 'HTTP_HOST' ] . htmlspecialchars ( $_SERVER [ 'PHP_SELF' ]) . " \n \n " ;
$contents .= 'password="$(tr -dc A-Za-z0-9 </dev/urandom | head -c 64)"' . " \n " ;
$contents .= '~/bin/mktuser ' . escapeshellarg ( $username ) . ' "$password"' . " <<< " . escapeshellarg ( $_POST [ 'ssh' ]) . " \n " ;
$contents .= 'echo "$password" > /sshfs/home/' . $username . '/pass && chmod 600 /sshfs/home/' . $username . '/pass && ssh 192.168.122.30 chown ' . escapeshellarg ( $username . ':' . $username ) . ' /sshfs/home/' . $username . '/pass' . " \n \n " ;
if ( $use_matrix ) $contents .= '~/bin/mkmuser ' . escapeshellarg ( $username ) . ' "$password"' . " \n " ;
if ( $use_akkoma ) $contents .= '~/bin/mkauser ' . escapeshellarg ( $username ) . ' "$password"' . " \n " ;
if ( $use_soju ) $contents .= '~/bin/mksuser ' . escapeshellarg ( $username ) . ' "$password"' . " \n " ;
if ( $use_git ) $contents .= '~/bin/mkguser ' . escapeshellarg ( $username ) . ' "$password"' . " \n " ;
if ( $use_nc ) $contents .= '~/bin/mknuser ' . escapeshellarg ( $username ) . ' "$password"' . " \n " ;
if ( $use_freshrss ) $contents .= '~/bin/mkfruser ' . escapeshellarg ( $username ) . ' "$password"' . " \n " ;
if ( $use_miniflux ) $contents .= '~/bin/mkmfuser ' . escapeshellarg ( $username ) . ' "$password"' . " \n " ;
if ( $use_penpot ) $contents .= '~/bin/mkppuser ' . escapeshellarg ( $username ) . ' "$password"' . " \n " ;
if ( $use_peertube ) $contents .= '~/bin/mkpuser ' . escapeshellarg ( $username ) . ' "$password"' . ' ' . escapeshellarg ( $email ) . " \n " ;
if ( $use_xmpp ) $contents .= '~/bin/mkxuser ' . escapeshellarg ( $username ) . ' "$password"' . " vern.cc \n " ;
if ( $use_xmppo ) $contents .= '~/bin/mkxuser ' . escapeshellarg ( $username ) . ' "$password"' . " vernccvbvyi5qhfzyqengccj7lkove6bjot2xhh5kajhwvidqafczrad.onion \n " ;
if ( $use_xmppi ) $contents .= '~/bin/mkxuser ' . escapeshellarg ( $username ) . ' "$password"' . " verncceu2kgz54wi7r5jatgmx2mqtsh3knxhiy4m5shescuqtqfa.b32.i2p \n " ;
2024-02-13 02:34:51 +00:00
$contents .= " s-nail -r 'register@vern.cc' -s 'Your ~vern account has been created' -M text/plain " . escapeshellarg ( $email ) . " < <(printf 'Hello %s, \\ nYour membership request on ~vern has been accepted. \\ nYou can now SSH into vern.cc using the public key(s) that you supplied to ~vern. \\ nA global password for all the services you signed up to can be found at ~/pass. \\ n \\ nThank you for being a part of ~vern!' " . escapeshellarg ( $username ) . " ) \n " ;
2024-01-25 16:19:03 +00:00
$contents .= " echo " . escapeshellarg ( $username . '@vern.cc' ) . " >> /var/spool/list \n " ;
$contents .= " echo " . escapeshellarg ( $email ) . " >> /var/spool/list \n " ;
$contents .= " mv $ 0 /var/log/register/ \n " ;
$contents .= " exit \n \n \n " ;
$contents .= $reason . " \n " ;
$filename = " /var/spool/register/ " . $username ;
$handle = fopen ( $filename , " w+ " );
chmod ( $filename , 0600 );
unset ( $filename );
fwrite ( $handle , $contents );
fclose ( $handle );
$from = " register@vern.cc " ;
$headers = " From: " . $from . " \n " ;
$headers .= " MIME-Version: 1.0 \n " ;
$headers .= " Content-type: text/plain \n " ;
mail ( $to , $subject , $message , $headers );
}
?>
2024-01-25 19:12:15 +00:00
<!-- #include file="footer.cgi" -->
2024-01-25 16:19:03 +00:00
</ body >
</ html >