## pull
git fetch --all
git reset --hard origin/main
## push
git push --force
## pull
git fetch --all
git reset --hard origin/main
## push
git push --force
데스크톱 공유: 접속하는 계정의 화면을 미러링
원격 로그인도 활성화 되어 있는 경우, 3390 포트로 접속해야 한다.
원격 로그인: 접속하는 계정으로 접속, 기존에 접속된 계정이 로그아웃 되고 새로 접속된다.
(즉, 기존에 띄워 놓은 창들이 다 사라짐)
rdp-tls.crt 파일을 Windows에 복사해다가 실행하여 설치한 후 재부팅 후 접속
$ grdctl --system status --show-credentials
Init TPM credentials failed because Failed to initialize transmission interface context: tcti:IO failure, using GKeyFile as fallback.
Overall:
Unit status: active
RDP:
Status: enabled
Port: 3389
TLS certificate: /var/lib/gnome-remote-desktop/.local/share/gnome-remote-desktop/certificates/rdp-tls.crt
TLS fingerprint: 04:2d:2b:1a:7c:8b:1a:21:68:73:3a:e7:2f:ca:c7:4f:58:20:bd:f5:7b:75:cd:a7:72:c2:5d:b3:a2:76:fc:f0
...
9월 12 14:40:25 ddakker-onl gnome-remote-desktop-daemon[1101]: [14:40:25:349] [1101:00001ef3] [ERROR][com.winpr.sspi.NTLM] - [ntlm_read_AuthenticateMessage]: Message In>
9월 12 14:40:25 ddakker-onl gnome-remote-desktop-daemon[1101]: [14:40:25:350] [1101:00001ef3] [WARN][com.winpr.sspi] - [winpr_AcceptSecurityContext]: AcceptSecurityCont>
9월 12 14:40:25 ddakker-onl gnome-remote-desktop-daemon[1101]: [14:40:25:350] [1101:00001ef3] [ERROR][com.freerdp.core.auth] - [credssp_auth_authenticate]: AcceptSecuri>
9월 12 14:40:25 ddakker-onl gnome-remote-desktop-daemon[1101]: [14:40:25:350] [1101:00001ef3] [ERROR][com.freerdp.core.transport] - [transport_accept_nla]: client authe>
9월 12 14:40:25 ddakker-onl gnome-remote-desktop-daemon[1101]: [14:40:25:350] [1101:00001ef3] [ERROR][com.freerdp.core.peer] - [peer_recv_callback_internal]: CONNECTION>
9월 12 14:40:25 ddakker-onl gnome-remote-desktop-daemon[1101]: [14:40:25:350] [1101:00001ef3] [ERROR][com.freerdp.core.transport] - [transport_check_fds]: transport_che>
9월 12 14:40:25 ddakker-onl gnome-remote-de[1101]: [RDP] Network or intentional disconnect, stopping session
네트워크 기본 DNS Server가 먼저 설정되는 문제
NetworkManager 및 /etc/resolv.conf 에 내가 원하는 DNS Server의 순서가 지정되지 않는 문제..
systemd-resolved 사용 안 하는게 정신 건강에 좋은듯..
(서버 아니고 PC 데스크탑임)
sudo systemctl stop systemd-resolved
sudo systemctl disable systemd-resolved
sudo vi /etc/nsswitch.conf
...
hosts: files dns
...
@Validated 기능 사용 시 Spring의 AOP Proxy 동과 관련되어 AService 클래스내에 @Autowired BService bService가 null 해결 방법
@Validated
@Service
class AService {
@Autowired
private BService bService;
private Test getTest() {
// bService null인 상황일때
}
}
@ActiveProfiles({ Application.ACTIVE_PROFILE_TEST_CASE })
@SpringBootTest
@ExtendWith(SpringExtension.class)
@TestMethodOrder(MethodOrderer.Alphanumeric.class)
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
@Slf4j
class TestCase {
@MockBean
private BService bService;
@Autowired
private AService aService;
@Test
void test() {
...
BService bService = new BService();
Mockito.when(bService.get1("1")).thenReturn(new Test());
...
ReflectionTestUtils.invokeMethod(AopTestUtils.getTargetObject(aService), AService.class, , "getTest");
}
}
## Flameshot 단축키 지정시 안되면
dbus-send --session --print-reply=literal --dest=org.freedesktop.impl.portal.PermissionStore /org/freedesktop/impl/portal/PermissionStore org.freedesktop.impl.portal.PermissionStore.SetPermission string:'screenshot' boolean:true string:'screenshot' string:'flameshot' array:string:'yes'
dbus-send --session --print-reply=literal --dest=org.freedesktop.impl.portal.PermissionStore /org/freedesktop/impl/portal/PermissionStore org.freedesktop.impl.portal.PermissionStore.Lookup string:'screenshot' string:'screenshot'
Class에 선언되지 않은 필드 정보가 넘어옴(columns 필드 선언되지 않음)
org.jboss.resteasy.spi.ReaderException: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "columns"
...
Caused by: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "columns"
무시하려면
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@JsonIgnoreProperties(ignoreUnknown = true)
public class .....
## configmap
apiVersion: v1
kind: ConfigMap
metadata:
name: test-cm
data:
kube.config: |-
# ~/.kube/config
apiVersion: v1
clusters:
...
name: kubernetes
contexts:
command: ncp-iam-authenticator
ncloud.config: |-
# ~/.ncloud/configure
[DEFAULT]
ncloud_access_key_id = G
ncloud_secret_access_key = d
ncloud_api_url = https://n
## deployment
spec:
replicas: 1
selector:
matchLabels:
app: test-app
strategy:
type: RollingUpdate
template:
metadata:
labels:
app: test-app
spec:
containers:
- env:
...
volumeMounts:
- mountPath: /home/default/.kube/config
name: kubeconfigcm
subPath: kube.config
- mountPath: /home/default/.ncloud/configure
name: kubeconfigcm
subPath: ncloud.config
restartPolicy: Always
volumes:
- configMap:
defaultMode: 420
items:
- key: kube.config
path: kube.config
- key: ncloud.config
path: ncloud.config
name: test-cm
name: kubeconfigcm
implementation ('org.springframework.boot:spring-boot-starter-jdbc') {
exclude group: 'com.zaxxer', module: 'HikariCP'
}
implementation group: 'org.apache.commons', name: 'commons-dbcp2', version: '2.9.0'
spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3380/testdb
username: root
password: test
dbcp2:
initial-size: 5
max-total: 10
test-while-idle: true
time-between-eviction-runs-millis: 1000
num-tests-per-eviction-run: 1
// https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/rollups/aes.js
// https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/rollups/pbkdf2.js
var passphrase = "key...변경";
var iv = CryptoJS.lib.WordArray.random(128/8);
var key = CryptoJS.enc.Hex.parse(CryptoJS.SHA1(passphrase).toString().substring(0,32));
console.log("key: ", key)
var ct = CryptoJS.AES.encrypt(str, key, { iv: iv });
var enc = iv.concat(ct.ciphertext).toString();
console.log("enc: ", enc)
## enc: b3ff8dd004bb643f0aba857baccb0d45e1565d2f4a1d727c9a268580d3a2031b
console.log("Result: " + CryptoJS.AES.decrypt({
ciphertext: CryptoJS.enc.Hex.parse(enc.substring(32))
}, CryptoJS.enc.Hex.parse(CryptoJS.SHA1(passphrase).toString().substring(0,32)),
{
iv: CryptoJS.enc.Hex.parse(enc.substring(0,32)),
}).toString(CryptoJS.enc.Utf8));
## Result: abcd
enc = "B8160A9EDCA2CFECE3E6444BFDE09B780D8DD2D873B93080E7F5A6F4B5644217";
console.log("JAVA 에서 암호화한 문자열 복호화 Result: " + CryptoJS.AES.decrypt({
ciphertext: CryptoJS.enc.Hex.parse(enc.substring(32))
}, CryptoJS.enc.Hex.parse(CryptoJS.SHA1(passphrase).toString().substring(0,32)),
{
iv: CryptoJS.enc.Hex.parse(enc.substring(0,32)),
}).toString(CryptoJS.enc.Utf8));
## JAVA 에서 암호화한 문자열 복호화 Result: abcd
// com.google.guava:guava:29.0-jre
import com.google.common.base.Charsets;
import com.google.common.hash.Hashing;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import javax.xml.bind.DatatypeConverter;
import java.security.AlgorithmParameters;
import java.util.Arrays;
public class AesCryptUtil {
private static Logger logger = LoggerFactory.getLogger(AesCryptUtil.class);
public static String encryptAES(String data, String secretKey) {
try {
byte[] secretKeys = Arrays.copyOfRange(Hashing.sha1().hashString(secretKey, Charsets.UTF_8).asBytes(), 0, 16);
SecretKey secret = new SecretKeySpec(secretKeys, "AES");
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
cipher.init(Cipher.ENCRYPT_MODE, secret);
AlgorithmParameters params = cipher.getParameters();
byte[] iv = params.getParameterSpec(IvParameterSpec.class).getIV();
byte[] cipherText = cipher.doFinal(data.getBytes(Charsets.UTF_8));
return DatatypeConverter.printHexBinary(iv) + DatatypeConverter.printHexBinary(cipherText);
} catch (Exception e) {
logger.error("===== exception", e);
throw new RuntimeException(e);
}
}
public static String decryptAES(String data, String secretKey) {
try {
byte[] secretKeys = Arrays.copyOfRange(Hashing.sha1().hashString(secretKey, Charsets.UTF_8).asBytes(), 0, 16);
String hexedIv = data.substring(0, 32);
String hexedCipherText = data.substring(32);
byte[] iv = DatatypeConverter.parseHexBinary(hexedIv);
byte[] cipherText = DatatypeConverter.parseHexBinary(hexedCipherText);
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(secretKeys, "AES"), new IvParameterSpec(iv));
return new String(cipher.doFinal(cipherText), Charsets.UTF_8);
}catch (Exception e) {
logger.error("===== exception", e);
throw new RuntimeException(e);
}
}
public static void main(String[] args) throws Exception {
String key = "key...변경";
String abcd = AesCryptUtil.encryptAES("abcd", key);
System.out.println("enc: " + abcd);
System.out.println("dec: " + AesCryptUtil.decryptAES(abcd, key));
System.out.println("javascript 암호화한 문자열 복호화 dec: " + AesCryptUtil.decryptAES("b3ff8dd004bb643f0aba857baccb0d45e1565d2f4a1d727c9a268580d3a2031b", key));
}
}
[참고] https://stackoverflow.com/questions/37368710/decrypt-aes-cbc-pkcs5padding-with-cryptojs
Decrypt AES/CBC/PKCS5Padding with CryptoJS
I generate 128bit AES/CBC/PKCS5Padding key using Java javax.crypto API. Here is the algorithm that I use: public static String encryptAES(String data, String secretKey) { try { byte[]
stackoverflow.com
GUI 화면이 잠겨 있는 상황에서는 RDP Client 에서 접속 안됨
Failed to start remote desktop session: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Session creation inhibited
Gnome Extensions > Allow Locked Remote Desktop 설치
https://extensions.gnome.org/extension/4338/allow-locked-remote-desktop/
아래 안 되는듯
Alt+F2, type lg
global.backend.get_remote_access_controller().uninhibit_remote_access = () => {}